As an atom-economical reaction, the direct generation of dimethyl carbonate (DMC) and ethylene glycol (EG) via the transesterification of CH3OH and ethylene carbonate (EC) has several promising applications, but the exploration of carriers with high specific surface areas and novel heterogeneous catalysts with more basic sites remains a long-standing research challenge. For this purpose, herein, a nitrogen-doped mesoporous carbon (NMC, 439 m2/g) based K-O2 Lewis base catalyst (K-O2/NMC) with well-dispersed strongly basic sites (2.23 mmol/g, 84.5%) was designed and synthesized. The compositions and structures of NMC and K-O2/NMC were comprehensively investigated via Fourier transform infrared spectroscopy, X-ray diffraction, X-ray photoelectron spectroscopy, scanning electron microscopy, transmission electron microscopy, N2 adsorption-desorption, CO2 temperature-programmed desorption, and contact angle measurements. The optimal structural configuration and electron cloud distribution of the K-O2/NMC catalyst were simulated using first-principles calculations. The electron transfer predominantly manifested as a flow from K-O to C-O/C-N, and the interatomic interactions between each atom were enhanced and exhibited a tendency for a more stable state after redistribution. Furthermore, the adsorption energies (Eads) of CH3OH at K-O-O and K-O-N sites were -1.4185 eV and -1.3377 eV, respectively, and the O atom in CH3OH exhibited a stronger adsorption tendency for the K atom at the K-O-O site. Under the optimal conditions, the EC conversion, DMC/EG selectivity, and turnover number/frequency were 80.9%, 98.6%/99.4%, and 40.5/60.8 h-1, respectively, with a reaction rate constant (k) of 0.1005 mol/(L·min). Results showed that the heterogeneous K-O2/NMC catalyst prepared herein greatly reduced the reaction cost while guaranteeing the catalytic effect, and the whole system required a lower reaction temperature (65 °C), a shorter reaction time (40 min), and a lower catalyst amount (2.0 wt % of EC). Therefore, K-O2/NMC can be used as a catalyst in different transesterification reactions.