Nitrogen-doped hierarchical porous carbon (N-HPC) was prepared from houttuynia cordata under the combined action of chemical activation and nitrogen-doping. The etching behavior of activator was enhanced by nitrogen doping while the proportion of pyridinic and pyrrolic nitrogen was promoted by the etching behavior. Theoretical calculations reveal that the activator is more likely to adsorb on the nitrogen-doped carbon surface and tend to etch carbon atoms besides the pyridinic, graphitic nitrogen and pyridine-N-oxide. The prepared N-HPC displays a large specific surface area of 2491.5 m2 g−1, and the nitrogen atoms in N-HPC exist mainly in the form of pyridinic and pyrrolic nitrogen. The N-HPC electrode exhibits a high specific capacitance of 220.5 F g−1 at 0.5 A g−1 and good rate characteristic in 6 M KOH electrolyte. The assembled symmetric supercapacitors exhibit a high energy density of 9.82 W h kg−1 at a power density of 162.33 W kg−1. This work reveals the interaction between nitrogen-doping process and etching behavior of the activator, and proposes a novel route for the synthesis of biomass-based carbon material for supercapacitors.