High-value utilization of biomass provided a feasible way to solve the energy shortage and environmental problems. The preparation of micro-mesoporous composite carbon materials from biomass waste as feedstock using a multistage gas self-exfoliation mechanism (CH3COOK and Ca2(C2H5COO)2) was a feasible approach. Among them, the N, O and S co-doped carbon materials were obtained in this paper by using forestry waste (bamboo) as raw material, spiral algae as green heteroatom dopant, Ca2(C2H5COO)2 as multifunctional template agent, and CH3COOK as gentle activator. The results indicated that BC-SA-0.5CP exhibited 324.85 F/g at 0.5 A/g. The symmetric supercapacitor (BSC-0.5//BSC-0.5) achieved 96.02% capacitance retention after 10,000 cycles, indicating excellent rate performance and charge/discharge stability. At a power density of 162.5 W/kg, the BSC-0.5//BSC-0.5 had an energy density of 14.67 Wh/kg. In addition, it was deeply analyzed the growth mechanism of heteroatoms, the formation mechanism of porous carbon and the electron transfer routes, which provided a theoretical basis for the preparation of biomass-derived carbon materials. Overall, this study demonstrated that the multistage gas self-exfoliation mechanism was beneficial in promoting the formation of micro-mesoporous composite structures and the growth of heteroatom functional groups, which ultimately provided a new route for the synthesis of natural heteroatom-doped porous carbon.