Development of high-performance and low-cost nonprecious metal electrocatalysts is critical for eco-friendly hydrogen production through electrolysis. Herein, a novel nanoflower-like electrocatalyst comprising few-layer nitrogen-doped graphene-encapsulated nickel–copper alloy directly on a porous nitrogen-doped graphic carbon framework (denoted as NixCuy @ NG-NC) is successfully synthesized using a facile and scalable method through calcinating the carbon, copper, and nickel hydroxy carbonate composite under inert atmosphere. The introduction of Cu can effectively modulate the morphologies and hydrogen evolution reaction (HER) performance. Moreover, the calcination temperature is an important factor to tune the thickness of graphene layers of the NixCuy @ NG-NC composites and the associated electrocatalytic performance. Due to the collective effects including unique porous flowered architecture and the synergetic effect between the bimetallic alloy core and graphene shell, the Ni3Cu1@ NG-NC electrocatalyst obtained under optimized conditions exhibits highly efficient and ultrastable activity toward HER in harsh environments, i.e., a low overpotential of 122 mV to achieve a current density of 10 mA cm−2 with a low Tafel slope of 84.2 mV dec−1 in alkaline media, and a low overpotential of 95 mV to achieve a current density of 10 mA cm−2 with a low Tafel slope of 77.1 mV dec−1 in acidic electrolyte.