Electrocatalytic water splitting have demonstrated an established methodology to generate hydrogen of high purity, attracting lots of attention from industry. However, deficient supplies or poor electrochemical stability of catalysts contributes to unsatisfactory electrocatalytic hydrogen production, particularly while maintaining high current densities. Herein, we develop a robust catalyst by directly phosphating raw single-walled carbon nanotube films which can be self-optimized into O-FePx-SWCNT, P-Fe2O3-SWCNT or P-FeOOH-SWCNT catalysts, depending on the selected electrolytes with different pH values. The electrochemical measurements reveal the excellent electrocatalytic performance of catalytic films in a wide pH range. Notably, there is no observable degradation, even following one-week of continuous electrolysis process, which reached an elevated current density of 125 mA/cm2 at neutral conditions. In order to manifest its cogent applications, the catalyst is employed to stably electrolyze lake water, further indicating potential hydrogen production in inland areas. Our work confirms the feasibility of using structural self-optimization engineering to develop desirable electrocatalysts, providing flexible catalytic films for practical applications and answering the long-standing controversial question about active sites based on X-ray absorption fine structure (XAFS), operando synchrotron radiation Fourier transform infrared (SR-FTIR) spectroscopy and theoretical calculations, which will significantly contribute to the advancement of HER-related basic and applied research.