Petroleum cokes are largely used as low-cost anodes in aluminum industries and general fuels in cement industries, where large amounts of CO2 are generated. To reduce CO2 release, it is challenging to develop green strategies for processing abundant petroleum cokes into high-value products, because there are abundant hetero-atoms in petroleum cokes. To overcome such issues, a sustainable electrochemical approach is proposed to convert ultralow-cost high sulfur petroleum coke and iron powders into high-efficiency catalysts for hydrogen evolution reaction (HER). During molten-salt electrolysis, raw petroleum cokes are converted into CNTs via heteroatom removal and the catalytic effect of Fe, forming Fe3C nanoparticles on the sulfur and nitrogen co-dopped carbon nanotubes (Fe3C@S, N-CNTs). The electrochemical reaction analysis using the continuum model suggested that the rate-determining step referred to the slow transport of mobile ions inside the porous cathode. Because the self-doped S and N atoms massively alleviated the energy barrier for H* absorption and H2 desorption (i.e., promoting HER kinetics), the as-prepared Fe3C@S, N-CNTs exhibited low overpotentials at 10mAcm-2 in acidic (96mV) and alkaline (106mV) solutions with ultralong-term duration (200h). This study offers a sustainable approach to convert ultralow-cost petroleum cokes into ultrastable catalysts for high-efficiency HER.