Keyboard stops working after a while of playing games.

Basically, it all started when I downloaded for a from the Xbox app, I plugged in my controller and 5 minutes later my keyboard stopped working as well as my mouse. This wasn’t much of a problem until when I wasn’t playing for a or using a controller my keyboard would work for a few seconds, then not work. (My mouse is fine by the way) And after around 30 minutes on a game the keyboard would completely be unresponsive. When I unplug it and plug it back in the same cycle happens where it’ll work for a little then not work and eventually turn off.

It’s not the keyboard, I’ve used 3 separate ones but I’ve noticed that when I used my dad’s old Mac keyboard there was no problems. Could this be a power supply issue?

I’ve used every video suggestion possible, updating the drivers, troubleshooting, everything.

This has been happening for weeks so I would greatly appreciate some help!