Headgears have represented a sign of class and status across the world. In India and most of the Middle East, the turban is a sign of respect, and often, headgear is gifted at weddings. In the 1800s, Hats were similarly a reflection of class and status in Europe. Top-Hats were a sign of elite status in Britain.
In the game of cricket, if a bowler were to take three wickets on three consecutive balls, or if a player were to score three goals in a football match, they were presented with a hat by the fans through a collection. It was a mark of respect offered to the individual who performed the feat.
Therefore, this came to be known as a Hat-trick.
The first known instance of this in cricket was in 1858, when H.H. Stevenson, who took three wickets on three consecutive balls and the fans collected money to buy him a hat.

