The bubbles in soda come carbon dioxide that is dissolved into the soda. Out in the open, carbon dioxide prefers to be a gas, but inside a soda bottle where the pressure is high, it's forced to be a liquid.
This dissolved CO2 at high pressure tends to come out when the lid is open