Normally all wired keyboards/mice running on Windows 10 should work on Xbox One, however some games don't support them so it's normal if it doesn't work every time.
If you're playing online, you should also check the game rules as some developers have set up an automatic ban for those using keyboard and mouse