White is a pawn up, it is his move, and he has just drawn the game. King on a8, pawn on a7, black king on c7. Count his legal moves: b7 and b8 belong to the black king, a7 is occupied by his own pawn, and that pawn cannot walk through its own king. Nothing. And no check.
Having no move is not the same as being beaten
Chess is won by attacking the king so that the attack cannot be answered, and every word of that matters. The king has to be under attack. A stalemated king is not attacked by anything: he is untouched, unthreatened, and simply out of moves, and no rule in the game says that running out of moves is losing. You cannot pass your turn either, so the position needs a ruling of its own, and Article 5.2 of the FIDE Laws gives it one. Draw.
Turn it round and see what you would be signing up for. If stalemate were a win, then boxing an opponent in would beat him just as well as mating him, and checkmate would stop being the object of the game. Half the defensive resources in chess would vanish with it.
It has not always been a draw
The rule is a settlement, not a law of nature. English players in the eighteenth century scored stalemate as a win for the player who had been stalemated, which is the exact opposite of a loss and must have made for some strange endgames. Elsewhere it was scored the other way, or as a half win. The modern draw is what the international game agreed on during the nineteenth century, when players from different countries began meeting over the board and somebody had to choose.
Endgame theory sits on top of it
Move that first diagram one file across and it turns into a win.
One file, and it is the difference between half a point and a whole one. A rook’s pawn is the only pawn whose king has no square on the far side to step aside to, so a bare king that reaches a8 in front of an a-pawn draws, and the same defence against a b-pawn loses. Every king and pawn ending you will ever study starts from facts of that shape, and they exist only because stalemate is a draw.
Which also makes stalemate a weapon rather than an accident. Down a rook with nothing left, the plan is often not to survive but to run out of moves at a moment of your choosing. From the winning side of the board the same fact is a hazard, and there is a page on how to avoid stalemate. For the milder version, where you do have a legal move and every one of them ruins you, see zugzwang.