Hi Maji,
I'm Cherrelyn and I'm here to help.
To fix the issue when the Xbox Game Bar will not open on Windows, ensure that you are focusing on a non-PowerShell or Cmd window before trying to open the Game Bar. You can open the Xbox Game Bar by using the shortcut Win + G or through the Start menu. If the Game Bar still does not open, check if your Windows version supports the Game Bar and ensure that it is up to date.
Please check this for your reference:
I hope this will help and if you have any question please don't hesitate to leave a comment.
Warm regards,
Cherrelyn