The decay you are describing (proton to neutron) is actually an anti-beta decay - it emits a positron instead of an electron. You can see this just by considering charge conservation; the particles going in have a net charge of +1 so the particles coming out must also have that charge.
This process happens in a nucleus that is proton-rich, meaning that it takes more energy to hold the nucleus together than it would if it had one more neutron and one fewer proton. Thus, if a proton were to be converted into a neutron, energy would be released. If the amount of energy released is greater than the amount of energy required to create a positron plus the amount of energy required to turn a proton into a neutron we say that the reaction is "energetically favorable" - it can happen without violating conservation of energy or requiring us to add energy to the system.
Generally if a reaction is energetically favorable it will happen eventually.