You need to remember that mass and energy are the same thing in different forms, so for example, the mass of the electron is 500,000 electron volts. You can't violate the 1st Law of Thermodynamics (mass/energy can neither be created nor destroyed), which is an inviolable law. When a proton is converted into a neutron, it has to acquire mass/energy from somewhere because the neutron is 3 mass units heavier than a proton. The answer is simple: the necessary mass/energy can be acquired from a collision with another massive particle or, on rarer occasions, by absorbing the energy of a neutrino or gamma photon. In order to become a neutrino, the proton also needs to acquire some negative charge so that the neutron can be neutral. It is impossible to create negative charger without creating an equal quantity of positive charge, so this unwanted positive charge is emitted as a positron, which also adds another mass unit to the equation. The kinetic energy of the particles involved must also be taken into account.