The Pi Zero W supports two different USB modes on its USB connector:
- USB Host mode, which is also called OTG mode (On-the-Go).
- USB device mode, which is also called gadget mode, but almost always incorrectly named OTG.
Unfortunately, the USB mode the Pi Zero W's USB electronics and connector cannot be changed on the fly, and thus no hotpluging possible which would also cause a change of the USB mode. The OTG mode is requested by shorting an additional fifth pin in the USB connector to GND (if I'm not mistaken). If this pin is left unshorted and thus floating, the USB electronics will be configured into USB slave mode.
Beware, changing the state of this OTG detection pin always does a hard reset without any warning (which is a pain in the back).
Still, USB hotplugging is still possible, but only if it does not change the state of the OTG detection pin. Unfortunately, power fluctuations when hotplugging a device may also cause an unexpected reboot, albeit the OTG pin was left as it was. This depends on the type of OTG shim/cable used, as well as how well your USB device behaves.
From my own experience with several Pi Zero Ws, different OTG cables and shims, and different USB devices I've some some combinations to work (almost) reliable, while others reliably cause reboots.
The Pi Zero W hasn't been designed for such usages (I think); even while the technical specs would be sufficient, better use the 3B(+) when you need reliable USB host functionality -- even if it needs more power, produces more heat, and takes up more space.