Your MOSFET is only specified for a gate drive voltage of 10V.

If you want to be sure your MOSFET will switch properly with the 5V gate signal provided by your arduino, then you must use a MOSFET which has RdsON specified at Vgs at or below 5V. Consider for example STP40NF10L:

There are many other choices, but make sure the RdsON spec at Vgs<5V is there, and the RdsON value is what you want according to motor current. Note threshold voltage is not relevant, it tells you when the FET begins to turn on, not when it is fully ON which is what you want.
Now you wired your 2N2222 wrong.

It would be the same as a FET. You want to use the NPN transistor or N-channel FET as a switch in common emitter mode (left), not as a follower (right).
Then your BJT requires enough base current to saturate properly. Check datasheet...

For 500mA motor current, you'll need a base current of 50mA which is already more than what an arduino pin can provide, and the VceSAT is quite high. So unless your motor is tiny and uses much less current than this, you should really use a MOSFET instead, or a low-VceSAT bipolar.