Why is Arduino resetting while driving motors?
The VIN pin goes to a 5V voltage regulator on the Arduino and needs at least about 7V minimum to work properly.  If you want to supply 5V to an Arduino do it either on the 5V pin or via the USB connector.  The VIN pin should receive 7V to 12V.