So this is a little complex, and I am greatly simplifying, but here goes...
Any system in the quantum world ends up with certain allowable energy levels. According to the Pauli exclusion principle, particles can occupy those levels only if they are different than others - so they can have different spins or charges, etc. In the case of a nucleus, this ends up causing there to be separate possible states for the neutrons and protons.
Generally, these systems want to evolve towards the lowest energy states possible. So you can imagine a helium atom with two protons and two neutrons, in which case they can all exist in the lowest possible state. Ok, now let's add a neutron. In this case, the lowest states are already filled, so the new neutron has to be in a higher energy state.
Now keep going up the periodic table. At some point, with many neutrons and protons, you end up with asymmetries that represent very large energies. That is, in order to add another neutron, it would have to go into to a very high energy band. If there's a free proton band at a lower energy, then if the neutron were to undergo beta decay then the overall energy of the nucleus is lower, so this becomes a favored pathway.