What is stalemate and why does it happen?

it's because your opponent doesn't have a move but they are not in check. this results in a draw. so make sure in the end game ypu take note of that. making sure they are in check or they have a move if you don't put them in check.

This is a beautiful example from one of your games. It is white’s turn, but they can’t move and are not in check.
https://www.chess.com/live/game/6308439425?username=blyizz