Here's an analogy that might help.
When an electron jumps from a higher orbital to a lower one, it produces a photon which carries away both energy and angular momentum. This is the energy difference and angular momentum difference between these two electron orbits.
When a neutron turns into a proton, the quarks change from an udd to an uud. So a down quark is changing into an up quark. This change is similar to when the electron changed orbits, but with a couple of key differences.
In the case of a down quark turning into an up quark instead of a photon, a $W^-$ virtual particle is created. It's virtual because the W's have mass and there isn't enough energy in this transition to account for this mass. But quantum mechanics will let this happen in its funny way.
The $W^-$ carries aways some energy, angular momentum and some electric charge. The $W^-$ isn't stable, and so will decay into an electron and an antineutrino. The electron and neutrino have a lower mass than the difference between the d and the u quark, and so the energy of transition is able to create real versions of them.
Over the full story, the energy, angular momentum and charge are all accounted for.
There are some nuances that I've glossed over, but that is pretty close to the legit picture.
This was actually why physicists (Wolfgang Pauli, Enrico Fermi) started to think that neutrinos and antineutrinos were a thing.
On its own, the electron that is produced doesn't have enough energy to account for the change in mass from the neutron to the proton. It also doesn't the right amount of angular momentum. So there must have been some other (hard to detect) particle that was carrying away the extra energy and angular momentum.
You might check out the story of the neutrino.