Why is it illegal to move into check? In chess, it is against the rules to move into check, or to not move out of check. But why? Obviously, if you went against this rule, you'd immediately lose. But it seems strange to make it illegal to lose in such a way.

Is there a reason for this rule? Is there a reason that chess ends with checkmate rather than capturing the king?
It is basically just a shortcut that cuts the game short by one move once the outcome is obvious. According to Wikipedia, "In early Sanskrit chess (c. 500–700) the king could be captured and this ended the game. The Persians (c. 700–800) introduced the idea of warning that the king was under attack (announcing check in modern terminology). This was done to avoid the early and accidental end of a game. Later the Persians added the additional rule that a king could not be moved into check or left in check. As a result, the king could not be captured."

The one difference from "real chess" that it does cause is actually rather significant. In a normal game of chess, stalemate is declared a draw, as Black has no legal move. For example: 

[title "Black to move"]
[FEN "4k3/4P3/4K3/8/8/8/8/8 w - - 0 1"]


If moving into check were allowed and capturing the king ended the game, Black could move his king in this situation and White would capture it, winning the game. Opinions vary, even among grandmasters, whether stalemate is a good rule for chess or not, but in any case it is a consequence of the check rules, and a large fraction of draws are the result of it. Once again Wikipedia has a good summary of the consequences for endgame theory of abolishing the stalemate rule and making capturing the king the requirement to win the game.