What escaping does is replace any characters that have special meaning in html (like
> that open and close html tags) by their corresponding escape sequences.
and here the browser doesn’t recognize any tags, so bad things don’t happen (unless you count this gibberish being printed on the page as bad things happening).
Whenever you handle strings that you get from your users, you have to do this. It’s even more important when you’re passing user input to some database, because otherwise your users could potentially obliterate all your data by sending you a string like
"DROP TABLE". There are lots of jokes about that one…