We successfully synthesized a porous carbon material with abundant hexagonal boron nitride (h-BN) dispersed on a carbon matrix (p-BN-C) as efficient electrocatalysts for two-electron oxygen reduction reaction (2e− ORR) to produce hydrogen peroxide (H2O2). This catalyst was fabricated via ball-milling-assisted h-BN exfoliation and subsequent growth of carbon structure. In alkaline solutions, the h-BN/carbon heterostructure exhibited superior electrocatalytic activity for H2O2 generation measured by a rotating ring-disk electrode (RRDE), with a remarkable selectivity of up to 90–97% in the potential range of 0.3–0.6 V vs reversible hydrogen electrode (RHE), superior to most of the reported carbon-based electrocatalysts. Density functional theory (DFT) simulations indicated that the B atoms at the h-BN heterostructure interface were crucial active sites. These results underscore the remarkable catalytic activity of heterostructure and provide a novel approach for tailoring carbon-based catalysts, enhancing the selectivity and activity in the production of H2O2 through heterostructure engineering.