The stomach produces acids, and other fluids in order to break down the food that we eat into a digestible from. The digestive juices in the stomach consist mainly of hydrochloric acid, which can dissolve even some metals!
The stomach, on the other hand, is made up mostly of protein, and if left unprotected, the acid would eat right through it. Fortunately for us, the stomach walls have a lining of cells that secrete a protective layer of mucus and bicarbonate. The mucus sticks to the walls of the stomach to provide a physical barrier, so the acid doesn’t touch the stomach itself. Bicarbonate is highly alkaline and protects the stomach from the danger of digesting itself.