The swift exhaustion of natural oil reserves and worsening environmental issues have prompted the quest for an economical method to produce biofuels. The superiority of heterogeneous catalysis promotes the development of bio-based catalysts. Carbon materials prepared from agricultural and forestry biomass waste have good application prospects in catalysis. In the present study, Xanthoceras sorbifolia shell waste was used as the raw material, Xanthoceras sorbifolia Bunge Carbon (XC) was used as the catalyst carrier, and K2CO3 was used as the activator to prepare a heterogeneous catalyst (KXC). The heterogeneous catalyst was characterized by scanning electron microscopy-energy dispersion X-ray spectroscopy (SEM-EDS), Fourier-transform infrared spectroscopy (FTIR), thermogravimetric analysis (TGA), X-ray diffraction (XRD), and Brunauer–Emmett–Teller (BET) and X-ray photoelectron spectroscopy (XPS) analysis techniques to evaluate its chemical composition, structure, and physical morphology. EDS and XPS revealed the presence of K metal, which provided an alkaline site for the transesterification reaction to produce biodiesel. The biodiesel yield was observed by gas chromatography−mass spectrometry (GCMS). Under the reaction conditions of a methanol-to-oil molar ratio of 12:1, a reaction time of 90 min, a temperature of 65 °C, and a catalyst loading of 4 wt.% using 25KXC-600-4, the yield of biodiesel can reach 95.13 ± 0.82%. After being repeated five times, the yield was still 58.11 ± 3.80%. The catalyst has no waste generation, and has the characteristics of simple preparation and environmental friendliness, which make it a green heterogeneous catalyst for biodiesel production.