Tuning the electronic structures of catalysts with heteroatom-doped carbon materials promises advanced electrocatalytic performance, but challenge remains in the control of interface structures. Taking advantage of the highly tunable metal−organic framework (MOF) templates, NiSe2@N-doped carbon (NiSe2@NC) core-shell nano-octahedrons with well controlled interface structures were successfully synthesized and optimized for the hydrogen evolution reaction (HER). Selective selenization of mixed-linker Ni-MOFs allows the replacement of anionic carboxylate ligands by Se22− while trapping neutral N-coordinating ligands in NiSe2 nanocrystals. Further carbonization of N-ligands embedded NiSe2 nanocrystals resulted in NiSe2@NC core-shell nano-octahedrons covered by ultrathin N-doped carbon shells. The N-species was controlled by changing N-coordinating ligands in MOF precursors, resulting in an optimized HER catalyst with a small overpotential of 162 mV at 10 mA cm−2, and good long-term stability (up to 40 h) in 1.0 M KOH solution. A strong correlation between pyridinic-N and HER activity was experimentally defined and explained by DFT calculations.