Fast DC motor resets Arduino?!

Here are 2 reasons why I think you are experiencing this problem. (Reason b is probably more likely, seeing that the motor is being powered through transistor. But still read reason a to get what I'm talking about).

a) The motor/transistor may be drawing all the power from the arduino so it has no electricity to keep the arduino on. It's like unplugging the arduino from it's power supply. When the motor is off and it isn't taking away any electricity the arduino gets enough power to turn itself on and starts the program at the beginning.

b) I was testing some transistors to see which pin was which and I powered a small 5v motor that works without a transistor, but the transistor sucked away all the arduino's power so it kept connecting and disconnecting from my computer. Maybe you have got the wrong type of transistor or it is connected to the wrong pins.Transistor pins don't go in the same order.