Porous carbon nanofibers doped with nickel (Ni) were successfully fabricated through electrospinning, carbonization, and CO2 activation techniques using polyacrylonitrile (PAN) and petroleum pitch as carbon sources and nickel acetate as the dopant. During the activation process, Ni was reduced and dispersed in situ on the carbon matrix. The effects of Ni doping content on the morphology and structure of the carbon nanofibers were systematically investigated using SEM, TEM, XPS, XRD, Raman, and BET analyses. The experimental results revealed that the prepared materials had a hierarchically porous structure and that Ni nanoparticles played multiple roles in the preparation process, including catalyzing pore expansion and catalytic graphitization. However, particle agglomeration and fiber fracture occurred when the Ni content was high. In the adsorption/desorption experiments, the sample with 10 wt% Ni doping exhibited the highest specific surface area and micropore volume of 750.7 m2/g and 0.258 cm3/g, respectively, and had the maximum hydrogen storage capacity of 1.39 wt% at 298 K and 10 MPa. The analyses suggested that the hydrogen adsorption mechanism contributed to enhanced H2 adsorption by the spillover effect in addition to physisorption.