Your stomach produces acid to digest food. The food passes from your esophagus into your stomach after which a flap closes and separates the stomach from the esophagus. This flap is only meant to open while swallowing and belching.
Well, there are many ways in which this flap opens when it is not meant to. Increased pressure in the stomach forces the esophageal flap to open and pushes stomach contents, including acid, into your esophagus.
Foods that disturb the functionality of the flap, either through relaxation or damage to cells, also lead to acid escaping from the stomach into the esophagus and that’s why the stomach acid causes the burning sensation. Not eating certain foods can help you avoid acid reflux attacks—check them out!