Hello Sun2109,
Thanks for choosing the Apple Support Communities. We see when you press one key, another is pressed instead when gaming.
To start, does this happen on just one game? Or does this happen all of the time? Here is a resource that can likely help.
If your Mac doesn’t respond to key presses - Apple Support
"ou may have accidentally set an option that changes how your keyboard operates.
- Choose Apple menu
> System Settings, click Accessibility
in the sidebar, then click Keyboard on the right. (You may need to scroll down.) Make sure Slow Keys is turned off. If Slow Keys is on, you must press and hold a key longer than usual before it’s recognized. - Choose Apple menu > System Settings, click Accessibility in the sidebar, then click Pointer Control on the right. (You may need to scroll down.) Make sure Mouse Keys is off.
- Choose Apple menu > System Settings, then click Keyboard
in the sidebar. (You may need to scroll down.) Click Edit next to Input Sources on the right, then turn on “Show Input menu in menu bar.” Open the Input menu, then make sure the correct keyboard layout is selected."
We hope this helps.
Cheers!