Carbon nanofibers (CNFs) containing boron and nitrogen are prepared from polyacrylonitrile and boron trioxide (B2O3) by using simple electrospinning. The B2O3 introduction into a PAN solution causes a porous structure with stabilized [O]BN functional groups to develop in the processes of stabilization and carbonization. The pore structure and the functional groups such as B atoms and [O]BN introduce synergistic effects by not only increasing the power density but also the energy density, as shown by the results. The energy storage capabilities of the electrode prepared from 20wt% B2O3 added to the PAN solution are as follows: a capacitance of 184.0Fg−1 and an energy density of 18.7–25.2Whkg−1 in the respective power density range of 400–10,000Wkg−1 in 6M KOH electrolyte. Hence, these CNFs exhibit a very promising potential as electrode materials for electrical double-layer capacitors due to their unique microstructure and proper proportion of heteroatoms.