Baking soda is a bicarbonate, which means that each molecule of baking soda
contains a sodium atom, a H atom, an O2 atom, and a CO2 molecule.
Vinegar contains acetic acid, and each molecule contains a H atom, and an acetate ion.
When they're combined, the hydrogen atom in the acetic acid meets up with the H and O2 atoms in the baking soda to form a molecule of water, while the acetate ion grabs onto the sodium atom and forms a salt, sodium, acetate. The CO2 molecule, free of its other chemical bonds, can now escape, and bubbles form as a gas.