Neutron decay and particles 
On this picture you can see that this $d$ quark turns into $u$ quark and makes this $W^-$ boson. $W^-$ then apparently turns the anti-electron neutrino, $\bar{\nu_e}$, into an electron, $e^-$.
My question is why can $d$ turn into $u$ and how is this $W^-$ produced?
And how does this $W^-$ boson turn into electron?
(what I found on Google didn't explain it really clearly to me)
 A: The $d$ quark can turn into the $u$ quark because they are particular quantum states of the quark (generally called flavours), in this case the quantum state the weak isospin state $T_3$. 
The $W^-$ boson is the particle that changes this flavour, so it is generated as a result of the beta-decay of the neutron (in the process of $T_{3}=-\frac{1}{2}\to T_3=+\frac12$). The $W^-$ boson is unstable with a half life of $\sim10^{-25}$ seconds, where it decays into an anti-neutrino and an electron. 
A: I want to elucidate a bit that this diagram is a type of Feynman diagram. This means it guides us to calculate the integrals that will give us the lifetime of the particle decaying. 
Calculable Feynman diagrams can be written for all three forces ( week strong electromagnetic). The W is the exchange particle of the weak force and the two vertices have very well determined values and functional forms.
So the down quark can decay to the up quark because it is energetically possible and the decay is mediated by the W-, is the way to read this diagram.  All particles are off mass shell except the neutron, the proton , the electron and the antineutrino_e . Off mass shell means the particles have all the quantum numbers of the particles with their name, except their four vector is off the mass value they have as real particles
