The two-electron oxygen reduction reaction (2e− ORR) presents a promising route for the on-site production of hydrogen peroxide (H2O2), offering a green alternative to energy-consuming anthraquinone process. However, the high selectivity toward the competing 4e− ORR over the desired 2e− pathway leads to low Faradaic efficiency for H2O2, posing a critical challenge in catalyst design. In this work, a nitrogen-doped hollow hierarchical porous carbon with anchored Co atoms (CoN/HPC) was constructed for high-performance H2O2 production. The as-prepared Co-N/HPC catalyst showed excellent 2e− ORR performance, achieving an H2O2 selectivity approaching 100% at an applied potential of 0.4 V (vs. RHE). Moreover, the in-situ generated H2O2 proved highly effective in degrading organic pollutants, showcasing a dual-functionality for environmental remediation. Physical characterizations and simulations confirmed that the enhanced performance is attributed to the unique hierarchical structure, which facilitates fast electrolyte diffusion and boosts H2O2 selectivity. This work opens a new avenue for the design of advanced electrocatalysts that integrate efficient H2O2 production with direct application.