Why is Na+ reduced instead of H+ in the electrolysis of dilute NaCl(aq) with Mercury cathode?
The mental conflict occurs because two processes could theoretically happen (electrodeposition of sodium, or electrodeposition of hydrogen), and the theoretically unfavorable one occurs - and not only occurs, but is so favorable that it was used commercially to produce NaOH as EdV noted.
So why is the theoretically favored process not favored in this instance? Hydrogen evolution is a multi-step process, and if you wave your hands a lot, you can call it overpotential and be off to other projects.
When (or if) sodium is deposited (on mercury), it can dissolve and be removed from contact with water. So this process is a slam-dunk if you push with a high enough voltage.
But the hydrogen evolution should take place at a lower voltage. Why not? If/when hydrogen is deposited, its first appearance is atomic: one H atom sticks somewhere on the mercury surface; the second step is deposition of another H atom somewhere else. The next step, for the two atoms to form a molecule, requires some mobility on the part of the hydrogen and the mercury surface. At this point, conventional wisdom suggests that the molecule could dissolve into the solution, but eventually the aqueous solution becomes saturated. Then the first molecule must meet another molecule, and another, to begin the process of forming a bubble which will eventually rise to the surface of the aqueous solution. Somewhere in there is an impediment to the formation of bubbles, and it may involve mobility of atoms or molecules, or attachment of hydrogen to mercury, but the process is difficult enough to allow the voltage to be raised high enough to allow deposition of sodium to proceed.
And then we say that mercury has a high overpotential for deposition of hydrogen.
Now suppose we do the same, but with gallium. Sodium should deposit and become dissolved as with mercury, if the voltage is high enough. (Sodium alloys with gallium; amalgamation is a chemical term that should be reserved for mercury alloys.) But the hydrogen overpotential on gallium is less than on mercury (Ref 1), and gallium and hydrogen are deposited together from a solution of $Ga^{+3}$ (Ref 2). So, in the case of liquid gallium, it seems that hydrogen would be more easily deposited than sodium (unless, perhaps you used a very high voltage, which would override the thermodynamic preference because diffusion couldn't keep up with the current demands).
Ref 1. https://pubs.rsc.org/-/content/articlelanding/1966/tf/tf9666203524/unauth#!divAbstract
Ref 2. https://link.springer.com/article/10.1007/BF01016217