Ginger ale is a beverage that generally contains as its ingredients ginger, sugar and carbonated water. Some brads of ginger ale may also contain other spices or fruits to impart a unique flavor.
Carbonated water contains carbon dioxide dissolved in water. At normal pressures the solubility of gases in water is very low. To dissolve gases in water, the pressure that is relevant is that just above the liquid surface. At high pressures, the gas molecules are pushed into the water and forced to remain dissolved. When the pressure is decreased the molecules escape from water.
A bottle of ginger ale is tightly sealed and has a very high pressure inside which forces the carbon dioxide gas to remain dissolved. When the bottle is opened, there is sudden drop is pressure. This makes the carbon dioxide escape in the form of a foam that is seen when bottles containing carbonated drinks are opened.
Ginger ale contains carbon dioxide which is held in a dissolved state in the liquid as long as the liquid is under pressure. Opening the bottle releases the pressure over the liquid, which allows the dissolved carbon dioxide to come out of solution, becoming gas bubbles.
The carbon dioxide in real ginger ale, like in all fermented drinks, initially comes from the fermentation process - yeast consume sugar and convert it to alcohol and carbon dioxide.