When acetic acid reacts with sodium bicarbonate, the following reaction takes place:
`CH_3COOH + NaHCO_3 -> CH_3COONa + H_2O + CO_2`
When acetic acid reacts with calcium carbonate, the resulting reaction can be expressed as:
`2CH_3COOH + CaCO_3 -> (CH_3COO)_2Ca + H_2O + CO_2`
In both the cases, we can see that the metal ion (sodium and calcium) is dissociated from the anionic group and this cation reacts with the acetate group to form the respective salt.
Sodium bicarbonate reacts faster, in comparison to calcium carbonate, since there is an exchange of only 1 electron between the sodium ion and bicarbonate ion. In comparison, two electrons are donated and accepted in the case of calcium carbonate. Thus, it is easier for sodium bicarbonate to dissociate and react with the acid.
Both sodium bicarbonate and calcium carbonate are used in antacids (drugs to relieve stomach acidity) and react with hydrochloric acid.
Hope this helps.