In this article, nitrogen (N) doped porous carbon nanofibers (N-PCNF) were prepared by carbonization of polymer-silica nanocomposite precursor, and its application for heavy metal ion removal was demonstrated. Carbon–silica composite nanofibers were obtained by carbonization of electrospun polyacrylonitrile (PAN)-silica nanofiber composites. Subsequent selective etching of silica porogen produced porous carbon nanofibers (PCNF). It was revealed by surface characterization with X-ray photoelectron spectroscopy (XPS) that the surface of the PCNF was nitrogen-doped because N atom from cyanide group in PAN chains remained in the hexagonal carbon structure. The use of the obtained N-PCNF for heavy metal ion ( Hg2+) removal was demonstrated using a simple adsorption test apparatus and 5, 10, 15, 20-tetraphenylporphine tetrasulfonic acid (TPPS) as an indicator. The N-PCNF showed a removal efficiency of 96 and 99% in 10 and 120 min, respectively, indicating a maximum heavy metal ion adsorption capacity at pH 7.0. In addition, heavy metal ion adsorption behavior was also analyzed using common adsorption isotherms. This article provides important information for future research activities regarding control over hazardous substances.