  We investigate the magnetic and superconducting properties in electron-doped
Li$_x$HfNCl. HfNCl is a band insulator that undergoes an insulator to
superconductor transition upon doping at $x\approx0.13$. The persistence of the
insulating state for $x<0.13$ is due to an Anderson transition probably related
to Li disorder. In the metallic and superconducting phase, Li$_x$HfNCl is a
prototype two-dimensional two-valley electron gas with parabolic bands. By
performing a model random phase approximation approach as well as
first-principles range-separated Heyd-Scuseria-Ernzerhof (HSE06) calculations,
we find that the spin susceptibility $\chi_s$ is strongly enhanced in the low
doping regime by the electron-electron interaction. Furthermore, in the low
doping limit, the exchange interaction renormalizes the intervalley
electron-phonon coupling and results in a strong increase of the
superconducting critical temperature for $x<0.15$. On the contrary, for
$x>0.15$, $T_c$ is approximately constant, in agreement with experiments. At
$x=0.055$ we found that $T_c$ can be as large as 40 K, suggesting that the
synthesis of cleaner samples of Li$_x$HfNCl could remove the Anderson
insulating state competing with superconductivity and generate a high-$T_c$
superconductor.
