IRF520 as a relay driver
What you missed is that threshold voltage for IRF520 is 4V. A MOSFET won't start conducting heavily (or completely turn ON) until threshold voltage is reached.
You are using 3.3 volts which is obviously less than that.You need a separate drive circuit or just use another transistor with a lower threshold voltage, say 3 volts.