In this study, based on the first-principles calculations, we systematically investigated the electronic and magnetic properties of the transition metal–oxide-incorporated 2D g-C3N4 nanosheet (labeled C3N4– TM–O, TM= Sc–Mn). The results suggest that the TM–O binds to g-C3N4 nanosheets strongly for all systems. We found that the 2D C3N4–TM–O framework is ferromagnetic for TM= Sc, Ti, V, Cr, while it is antiferromagnetic for TM= Mn. All the ferromagnetic systems exhibit the half-metallic property. Furthermore, Monte Carlo simulations based on the Heisenberg model suggest that the Curie temperatures (Tc) of the C3N4–TM–O (TM= Sc, Ti, V, Cr) framework are 169 K, 68 K, 203 K, and 190 K, respectively. Based on Bader charge analysis, we found that the origin of the half-metallicity at Fermi energy can be partially attributed to the transfer of electrons from TM atoms to the g-C3N4 nanosheet. In addition, we found that not only electrons but also holes can induce half-metallicity for 2D g-C3N4 nanosheets, which may help to understand the origin of half-metallicity for graphitic carbon nitride.