Why does my resistor start smoking when current runs through my circuit?
\$ \small P = I^2 \cdot R\$ is dissipated in R2, about 3.4W, so you need a resistor that can handle that to keep the smoke in. It will still get hot.
You may want to consider using a 6V power supply for the electromagnet; it would be less wasteful.
Also, as mentioned in the comments, you didn't connect the FET the right way (or your schematic doesn't match what you actually built); as it is shown, with drain shorted to source, it doesn't do anything, and the Pi can't turn the electromagnet off.
Also, the IRF530 isn't a very good choice for using with 3.3V logic; see Fig. 3 (transfer characteristics) in the datasheet.