To address the issue of harmful gases Hydrogen fluoride (HF) and hydrogen chloride (HCl) in metallurgical waste gas, this study utilized metal oxide modified molecular sieve (MCM-41) for their simultaneous removal. The adsorption and removal of HF and HCl are mainly influenced by alkaline sites and pore structure, with alkaline sites having a greater impact. MgO affects the alkaline site strength and pore structure, thereby facilitating the removal of HF and HCl. On the surface of the adsorbent, HF and HCl react to form MgF2 and MgCl2, which gradually reduces the adsorbent's performance. HF and HCl have a higher adsorption strength on the MgO surface, and the H…O interaction causes a more stable adsorption configuration. There is a competitive adsorption effect between HF and HCl, with HF having a preference for adsorbing on the MgO surface over HCl. The adsorption energies of HF and HCl are unlimited by adsorption effects. When the O atom in MgO is replaced by HF and HCl, Mg-F bonds, Mg-Cl bonds, and H-O bonds are formed, resulting in the formation of MgF2, MgCl2, and H2O. HF is easier to prioritize removal than HCl