Water in the tap or bottle has gas dissolved in it which is  primarily oxygen and nitrogen from the air.  As it goes from the tap into the glass, it warms up, and is at lower pressure than in the pipe. Thus, the dissolved gases come out of solution, and form bubbles on the tiny imperfections on the surface of the glass. This is due to the temperature dependence of the solubility of gases in water. so the gas comes out of solution to form bubbles.
1 5 1