I'm pretty sure I ruined a Nano by accidentally plugging it into the USB (5V) of my laptop and also running 9V from a power adapter into Vin, (at the same time).
Just wanted confirmation that this is what made the Nano operate strangely afterwards.
Because it could not damage your Arduino nano. How else would you communicate with your PC and power the Nano at the same time. Likely strange stuff is really normal stuff, depending on your program.
It should be safe to use Vin and power via USB on official classic Arduinos. It's not always safe (for your PC) to power via USB and at the same time via 5V; that depends on the board in question.
I have a Mega power with 9V on Vin and via USB for a couple of years now and it does still work.
Note:
This reply assumes official classic Arduinos (Nano, Uno, Mega); for clones you are on your own and you will have to find the schematics of the exact board that you have.
When the Nano is powered from the USB port alone, current flows through the diode D1, from VUSB to provide the +5V that powers the Nano.
When the Nano also has power going to VIN, then the voltage regulator will supply the +5V for the Nano. The diode prevents the +5V from going to the USB port.