Stalemates aren't simply draws; in chess, they have a more specific meaning.
Stalemates happen when it is a player's turn to move and they have no legal moves they can make, but they are not in check. It doesn't matter whether that player is losing, winning, or going to get a draw anyway.
When you make your moves and are going in for the kill, you must remember that if you aren't putting your opponent into check then you have to leave them a move. If not, you'll miss out on the win and end up with a draw.
Why does the CPU naturally give you a stalemate when it is not a true stalemate? I don't know if anyone else finds this ridicuous like me. How many times do you a remarkable advantage and will eventually win and the CPU says stalemate. Very frustrating.