The process of HCl formation occurs within the parietal cells of gastric glands. When parietal cells are appropriately stimuated, H+ is actively pumped into the stomach lumen by H+K+ ATPases (proton pumps). As acid is pumped into the stomach, base (HCO3−) is exported into the blood. This flow of base is called the alkaline tide.
Initially it starts when the Carbon dioxide combines with water in the parietal cell and forms carbonic acids which readily dissociates into its ions bicarbonate and proton. Then ultimately we get two ions in the stomach lumen chloride ion and proton . Both combines together and produces the HCL.