Why does water get air bubbles?

Have you ever just let a glass of water sit? After a while air bubbles start to form on the inside of the glass. Why?

What is happening is that the cold water is warming up. Cold water (or water at high pressure) can hold more dissolved gas than warm water (or water at low pressure). Your glass of water started out cold. You let it sit, and it warmed up to room temperature. The water now can’t hold as much dissolved gas as it used to. If it had more gas than it can now hold, the gas will come out of solution as air bubbles, which will form on the inside surface of the glass.

This is also what causes “the bends” for divers. Blood plasma is 95% water. Under high pressures blood can hold more dissolved gases. Over time nitrogen (~80% of air) dissolved in the blood. When the diver returns to the surface, the lower pressure causes the nitrogen to come out of solution in the blood, causing the bends.