What is humor?
A really complex question.
It seems that babies usually start laughing at about 5 weeks.
It seems that laughter is a very primal experience, that comes well before language acquisition.
In evolutionary terms, it seems to be part of a social bonding mechanism, one of shared experience.
At higher levels, it seems to be able to go in any number of directions – some of which are socially cohesive and many of which are highly destructive (the classic evil laugh).
It is often associated with inappropriateness – things out of context, or unexpected outcomes.
Often it is a mechanism for reducing social tension in such situations (suggesting that an outcome was done just to produce laughter rather than some other far less desirable motive).
So a really complex topic – infinitely deep and recursive.