When you eat, your stomach produces hydrochloric acid and an enzyme called pepsin to digest the food.
The food is partially digested in the stomach and then moves on to the duodenum to continue the process.
Peptic ulcers occur when the acid and enzyme overcome the defense mechanisms of the gastrointestinal tract and erode the mucosal wall.