When hydrogen nuclei are able to overcome the coulomb forces, two protons collide. As a result, one of them decays into a neutron and a positron and electron neutrino are emitted. However, isn't mass gained in this scenario because the the sum of the mass of a proton and neutron is larger than the sum of two protons? I might be missing something completely obvious and may be overthinking this.
The mass of the deuteron is less than the mass of two protons.
$$ \rm p + p \to d + e^+ + \nu_e, $$
we have an initial mass excess of 13.56 MeV changing to a final of only 13.14 MeV. The remaining 0.42 MeV is available as extra kinetic energy for the reaction products.
Note also that a free neutron and free proton together are also more massive than the deuteron, by about 2.2 MeV. That's why the deuteron is stable against dissociation.
To overcome coulomb forces energy has to be provided to the two protons, and if it is high enough a proton can change into a neutron (inverse beta decay).
At higher energies in proton proton colliders, the higher the energy .the more particles can be created, as in the LHC. In stars the energy is provided by the kinetic energies sof the ions in the plasma. –
Here is the wiki article :
In general, proton–proton fusion can occur only if the kinetic energy (i.e. temperature) of the protons is high enough to overcome their mutual electrostatic or Coulomb repulsion