The word “wassail” comes from the Middle English toast waes hael – “good health”. It refers both to a drink and a pair of customs associated with the drink.

The word "wassail" comes from the Middle English toast
waes hael - "good health".
The earliest form of wassailing seems to have been a fertility ritual, focused specifically on fruit trees. A large bowl of wassail would be prepared – some of these bowls were very ornate – and it would be ceremoniously poured on the roots of the fruit trees, the aim being to ensure a bountiful harvest in the coming year.
A later custom, also called wassailing, involved groups of carolers going door to door to regale their neighbors with the music of the season. In return, they would receive food and drink (including wassail) and sometimes money. It is this latter custom, I suspect, that led to two well-known carols – Here We Come A-Wassailing and Here We Come A-Caroling – and explains why the tunes are identical.
Waes hael!