To improve on Enes' answer a bit, the Pi has regulators that will kill the Pi to protect the circuitry if a surge is detected.
Hot-plugging (plugging in a USB device while the host device is running) will cause a sudden jump in current requested, which often will trip these regulators.
This is a known issue, especially with a less powerful PSU. You can combat this by using a more powerful PSU, one that has a higher amperage because a higher amperage is a stronger current; stronger current means better chance of continuous power when more power is requested.
Another thing you can do to stop this from happening is to use an externally powered USB hub, externally and powered being very crucial. This method works because instead of pulling power for the Pi's components (SoC, Ethernet, USB ports, etc.,) all of the power can be used for the USB devices.