In the use of the electric double layer capacitors (EDLCs) with carbon electrode materials, what remains an important technological challenge is that existing carbon electrodes suffer from low energy density and low volumetric capacitance, the today's need for making energy storage architectures. The incorporation of the n-type and/or p-type dopant elements in carbon structure may result in an enhancement in the capacitance. Accordingly, the idea to use the layered nanoreactors was applied to produce phosphorous-doped and boron-doped porous carbon nanostructures with high specific capacitance (CS) values when used in supercapacitor electrodes. So that, the best P-doped and B-doped carbon electrodes show the CS values of 322 and 275 F/g, respectively, at a current density of 1 A/g in the three-electrode system. A symmetric supercapacitor device made using the best doped carbon material (CG-P) showed a CS value of 163.2 F/g at a current density of 0.1 A/g. Herein, this work shows that the high values of CS for carbon materials are due to high accessible surface area, excellent pore size distribution, the presence and uniform dispersion of the dopant agents in carbon structures.