ESP8266 (connected to Arduino) only works when plugged into USB power
It sounds like your power supply is inadequate to the task.

The ESP8266 is notoriously finicky about having a noise free power supply capable of delivering a lot of instantaneous power. If you are using a wallwart style supply it should promise at least 1A and more is better. Even though the actual use is more like 250 mA.