Answer:
We all know that HCI is highly corrosive mineral acid. It's produced naturally in our (Human being) Stomach
It (HCI) is produced by the gastric glands in stomach. HCI activates the enzyme Pepsin and creates an acidic medium which kills the bacteria which might have entered while digestion & also making it simpler for further digestion.
HCI does not harm our stomach because the gastric gland also produces Mucus which helps in preventing the damage of inner wall (layer) of stomach from the action of this Acid.