Well when you take an antacid, it fought against the acid in your stomach which is bothering you because antacids are bases. After fighting they will both turn neutral which makes the stomach feel...
Well some antacids bind with the stomach acid, to stop the stomach acid from rising up. Others form a layer over the stomach acid which also stop the acid from rising up and getting that burning...
They are partially made out of baking soda (sodium hydroxide) and it neutralizes acid. Over production is usually what causes an upset stomach or heart burn.