Because a legal chess move must leave your own king safe. You cannot move a piece if doing so exposes your king to attack, and you cannot move your king onto a square controlled by an opponent’s piece. If your king is already in check, your move must get it out of check.
What counts as leaving your king in check?
Your king is in check when an opponent’s piece attacks the square it occupies. A move is illegal if it allows that attack to continue or creates a new one. For example, a pinned piece cannot move away if doing so would uncover an attack on its king.
This applies even if the move would also put your opponent’s king in check. You must protect your own king first.
What can you do when you’re in check?
You must make a move that removes the threat. Depending on the position, you can:
- Move the king to a safe square.
- Capture the attacking piece.
- Block the attack with another piece, if the check can be blocked.
If none of these options is legal, it is checkmate and the game ends. The king is not actually captured; the rules prevent a player from making a move that leaves it under attack.