This diagram shows how you can use a 2N7000 field effect transistor to drive a motor from an Arduino. This assumes that the motor is powered by the battery that is plugged into the Arduino, usually a pair of 18650 cells giving a voltage of around 8V. You don't need to use pin 5. Any of the general I/O pins will do. Writing pin 5 HIGH turns the transistor on, and connects the motor to Vin and Gnd.