Graphitic carbon nitride (g-C3N4, CN) has been recognized as an environmentally friendly, and promising photocatalyst, particularly for solar-driven synthesis of hydrogen peroxide (H2O2). Heterostructure engineering to decorated CN is an effective approach for boosting photocatalytic H2O2 production. However, the current challenge lies in the efficient transmission of interfacial charge carriers. Herein, we propose a breakthrough approach to synthesize g-C3N4/Mxene (CNM) composites with lignin-derived carbon (L) as a bridge for electron transfer. The optimal ternary heterojunction (CNM,L) demonstrated its impressive performance (0.75mmol/L) for photocatalytic H2O2 production, which was three times higher than that of pristine CN. The significance of lignin-derived carbon in g-C3N4/Mxene composites not only improves light adsorption, but also promotes electron transfer between the interfacial g-C3N4 and Mxene during the oxygen reduction reaction (ORR) process for H2O2 evolution. This work provides an eco-friendly design of lignin-derived carbon, which efficiently tunes the photo-generated charge transfer of CN-based photocatalysts for H2O2 generation.