MXene is investigated as an electrode material for different energy storage systems due to layered structures and metal-like electrical conductivity. Experimental results show MXenes possess excellent cycling performance as anode materials, especially at large current densities. However, the reversible capacity is relatively low, which is a significant barrier to meeting the demands of industrial applications. This work synthesizes N-doped graphene-like carbon (NGC) intercalated Ti3C2Tx (NGC-Ti3C2Tx) van der Waals heterostructure by an in situ method. The as-prepared NGC-Ti3C2Tx van der Waals heterostructure is employed as sodium-ion and lithium-ion battery electrodes. For sodium-ion batteries, a reversible specific capacity of 305 mAh g−1 is achieved at a specific current of 20 mA g−1, 2.3 times higher than that of Ti3C2Tx. For lithium-ion batteries, a reversible capacity of 400 mAh g−1 at a specific current of 20 mA g−1 is 1.5 times higher than that of Ti3C2Tx. Both sodium-ion and lithium-ion batteries made from NGC-Ti3C2Tx shows high cycling stability. The theoretical calculations also verify the remarkable improvement in battery capacity within the NGC-Ti3C2O2 system, attributed to the additional adsorption of working ions at the edge states of NGC. This work offers an innovative way to synthesize a new van der Waals heterostructure and provides a new route to improve the electrochemical performance significantly.