There is acid in our stomach, if poured on your face, it will corrode your face. The reason it does not destroy your stomach is because of the layer of muchos that protects the stomach from the acid.
When a certain bacteria named H. pylori finds a way to burrow through the mochus and hides, stomach acid then follows it and starts to cause pain.
For some, these bacteria have been present for a long time, they spread through dirty water, infected utensils, and Silva of an infected person. To prevent avoid the bacteria, avoid drinking dirty water and using dirty/unhygienic utensils.
One common notion is that hunger is responsible for all ulcer pain, let me categorically inform you, that it is false, it is not only hunger that causes ulcers. One of the fundamental cause of Ulcer is an infection that must be terminated by the use of supplements.