Motors controlling Arduino usb question
From the very sketchy description of the problem as provided, one can only speculate that possibly the Arduino board or the motor drivers are not receiving sufficient power in the battery powered mode, to function normally.

The older 5 Volt Arduino boards are designed to operate with either a 5 Volt regulated supply on +5V pin, 5 Volts through the USB, or a DC voltage of between 7 and 12 Volts (or thereabouts) from an external supply. While most Arduinos will operate down to 6 Volts on the external supply, ~5.4 Volts leaves too little headroom for the on-board Low Drop Out regulator to output a stable 5 Volt. 

Also, on turning on any of the motors, it is almost definite that the supply voltage will drop even further at least briefly, thus causing unpredictable behavior from the Arduino, including possible board resets.

If you must use the 5.4 Volt battery, better results may be obtained by using a buck-boost regulator (DC-DC step-up+step-down regulator, not a linear regulator) that is capable of producing a regulated 5 Volts from an input voltage all the way down to 4 Volts or so, and up to 6 or more Volts. That way, the Arduino is assured of a stable 5 Volt supply despite battery supply variations over a wide range.

For a more problem-specific resolution, it helps to provide a schematic and more detailed information, including perhaps relevant code.