Producing hydrogen peroxide (H2O2) by electrochemical O2 reduction is a promising process, although developing high-performance carbon-based electrocatalysts at a low-cost with high-volume production remains a great challenge. We report a novel method to prepare the excellent electrocatalysts for the H2O2 production derived from the fungal hyphae (with bioconcentrated dye), which was used as the main sources of C, N, O, and P. The optimizational electrocatalyst had a large surface area with many nanopores, which exhibited excellent activity, selectivity, and stability towards O2 reduction when producing H2O2 in an alkaline media and good activity, selectivity, and stability in neutral media. A flow cell with the optimizational electrocatalyst as cathode and IrO2 as anode exhibited exceptionally high Faradaic efficiency, H2O2 productivity, and energetic efficiency in alkaline media. This maintained the Faradaic efficiency and H2O2 productivity when driven by commercial dry battery (1.5 V) or by solar-energy battery (2.5 V or 3.0 V). This is helpful in developing an electrocatalyst for H2O2 production and practical industrial application of O2 reduction to H2O2 by electrocatalysis. This low-cost, simple, and readily scalable approach offers insight for developing a novel electrocatalyst for other electrochemical reactions, such as hydrogen evolution reactions, oxygen evolution reactions, and CO2 reduction reactions.