It can’t, and in a legal game it never gets the chance. The game ends at checkmate, the move before any capture could happen, and the FIDE Laws rule out “capturing” the opponent’s king in so many words1. The two kings can’t stand side by side either, because each would be moving into check. Your king can still take any other piece next to it, a queen included, as long as nothing guards that square.
Why people argue about it
Speed chess keeps the idea alive. In a rated blitz game in 2022, a player with only a king and bishop took a king the opponent had left in check, and the director awarded the win. Players on the US Chess forum then took sides on whether the grab should count2. Variant sites still list Capture the King as its own game for tables that want to play to the grab3.
The first time someone leaves their king in check, you point it out and they replay the move. After that warning, a king left in check can be taken, and that ends the game.
Instead of
A move that leaves your own king in check isn't allowed, and no king is ever captured.
Checkmate or the grab: which ends your game? It matters most in fast play. Agree whether a king left in check can be taken, and whether that counts as a win or a takeback. Play to the capture drops checkmate, so play runs until a king is actually taken. One warning, then the grab points out the first slip and lets the player replay the move, then allows the capture after that. For learners, we’d use One warning, then the grab.
Play it a different way? Post it so others can vote on it.