The gas (bubbles) in soft drinks is carbon dioxide (CO2), which is dissolved as carbonic acid H2CO3.
This acid is again slowly decomposed to carbon dioxide gas. This process will continue to a state of equilibrium. In a closed can or bottle the air (headspace) and the liquid are both saturated with the gas. When opened the equilibrium is disturbed, as the carbon dioxide will disappear from the headspace. This results in more formation from carbon dioxide from the liquid, which is released as bubbles.
For bubbles to be formed a surface is needed. Most surfaces are very rough on a microscopic scale. On these rough areas tiny pockets of gas may (slowly) be formed, these are called nuclei. When a nucleus is formed it may grow rapidly into a bubble, depending on the conditions, such as when a bottle is opened.
Adding sugar grains to a saturated solution of carbon dioxide, such as beer or soft drink, is, on a molecular level, creating a very large and very rough surface. On this surface microscopic air pockets are trapped when submerged into the liquid. These thousands of air pockets all act as nuclei, which results in a sudden explosive formation of bubbles.