The chemical reaction that takes place is as follows:
2HCl (hydrochloric acid) + CaCO3 (calcium carbonate) → CaCl2 (calcium chloride) + H2O (water) + CO2 (carbon dioxide)
The calcium chloride and water remain dissolved in the solution, while the carbon dioxide gas escapes into the atmosphere. This reaction is also known as "acid dissolution" and is a common process that occurs in nature when acidic substances come into contact with carbonate rocks, such as stalagmites.
Stalagmites are formed by the precipitation of calcium carbonate from water that seeps through the cracks and crevices of caves. As the water drips from the ceiling of the cave, it loses carbon dioxide and the dissolved calcium carbonate is deposited, building up the stalagmite over time.
When hydrochloric acid comes into contact with the stalagmite, it reacts with the calcium carbonate and produces carbon dioxide gas. The escaping gas bubbles cause the effervescence that is observed.