I have a MacBook Pro 16" running Monterey 12.2.1 and have the same issue. Mine is the last version (i9) before the M1 MacBooks. The issue happened before on Catalina as well. Seems to happen on either side ports (I have 2 USB-Cs on either side, nothing else). I'll have a USB hub (tried multiple -- it's not the hubs) or directly plug in a mouse, Wacom, USB stick, or any single one of these. Randomly, it seems, they will stop working. At first when this happened, I only had my mouse plugged in, connected via an Apple USB-A to C adapter. I thought my trusty Microsoft optical mouse of many years finally kicked the bucket. Nope, works fine. Tried it on other machines -- no issue. Swapped the port to the other side of my MacBook, and it works great again.
I've also had more than one external drive get corrupted (using APFS) when this issue happens while they are plugged in. Tried an SMC reboot (How to reset the SMC of your Mac - Apple Support) doesn't fix the issue (at least, it will happen again soon). Made the jump from Catalina to Monterey, still happens. I also notice that the most minor touch to anything plugged in (eg - 2nd monitor) can cause it to momentarily detach, even trying several cords. All the USB hubs, cords, etc have been tried on other computers and I'm positive they are not the issue.
I think I may just have to take the computer in for AppleCare coverage.