Electrochemical water splitting stands out as a promising avenue for green hydrogen production, yet its efficiency is fundamentally governed by the oxygen evolution reaction (OER). In this work, we investigated the growth mechanism of CoFe hydroxide formed by in situ self-corrosion of iron foam for the first time and the significant influence of dissolved oxygen in the immersion solution on this process. Based on this, the CoP2-FeP4/IF heterostructure catalytic electrode demonstrates exceptional OER activity in a 1 M KOH electrolyte, with an overpotential of only 253 ± 4 mV (@10 mA cm−2), along with durability exceeding 1000 h. Density functional theory calculations indicate that constructing heterojunction interfaces promotes the redistribution of interface electrons, optimizing the free energy of adsorbed intermediate during the water oxidation process. This research highlights the importance of integrating self-corroding in-situ growth with interface engineering techniques to develop efficient water splitting materials.