I have had problems like this in the past, though I was lucky it only rebooted my computer.
Can not explain exactly why this happens. Most likely a voltage differential or a floating ground.

Though found that if you plug the USB into the 3D Printer controller when powered on this can happen.
However if you plug in the 3D Printer Controller then power on the 3D Printer it does not happen.
OR
If you use a laptop that is on battery this never happens.