We’re not the only animals to laugh. Chimpanzees laugh. Crows have been observed behaving in ways that suggest they have a sense of humor.
Humor can be explained through evolution. It’s a “reward” for pattern-recognition, which underlies our large brain’s evolutionary advantage. Brains process incoming information, and brains that can sense patterns and form behavior accordingly are better able to survive. It follows that brains that reward pattern-recognition itself in some way (to sharpen the ability) would also survive more often.
If you dissect the things we laugh at, a lot of them deal with incongruities or weird juxtapositions that don’t make sense. When you realize that something doesn’t line up right, or that there’s an ambiguity in how it lines up, you laugh. Laughter is your “reward” for the realization.