Yes, he was the weird man in Alice in Wonderland, who wore an unusually large top hat & played games with the young & innocent Alice. However, there is more! The origins of the Madhatter come from England & the story goes like this:
In 17th century England there was a group of men known as hatters who made hats for a living. The hatters labored day & night to produce quality head wear. They were also in the business of cleaning the hats they made & mercury was used in the process. After several years of breathing the mercury fumes, the hatters gradually went mad.
But, we are not quite sure whether it was the mercury that was totally responsible for all the madness. It seems to be that even today, any person that wears a hat is a little different. Remember W.C. Fields, he always wore a hat. Charlie Chaplin? Laurel & Hardy? These guys had character, and a little madness. Their hats made them what they were