The work is devoted to the synthesis of graphene-like magnetic nanocomposites by direct pyrolysis of hemp microcrystalline cellulose modified with citric acid containing nickel or cobalt salts. Their chemical structure and morphology were characterized by X-ray diffraction (XRD), electron microscopy (SEM), Raman spectroscopy, low-temperature N2 adsorption-desorption, and Fourier transform infrared spectroscopy (FT-IR). Thermogravimetry has established a possible mechanism of pyrolysis of a modified cellulose matrix containing Ni and Co metals. X-ray diffraction analysis and Raman spectroscopy have shown that an increase in the number of carboxyl groups accelerates the process of graphitization of the cellulose matrix with transition metals (Ni and Co), as well as increases the degree of structural order and the level of graphitization. The conducted studies have shown that nanoparticles of metals of the zero-valence state are enclosed in graphene-like shells having a mainly mesoporous structure.