You normally have the high-current circuit so that the current flows from the power source through the load ( your electromagnet ) and then through the switching device ( your transistor ) and then to ground ( back into the power supply ).
So you control the current coming out of the load, not going into it.
In this aspect, the diagram you drew in your very first post, is the wrong way around.
The reason you do this, is because the arduino ground is the same ground, and you need to have the base/gate voltage of your transistor device at a level close to ground, that the arduino can manage.
If you have a 12 V ( or higher ) power supply, and you want to put your transistor device on the high side of the load, then you have to be manipulating the base/gate terminal of the transistor around 9 or 11 or 12 volts, which is possible, but more complicated, using the arduino. You probably also need to use a P type transistor.