The Mad Hatter's madness is often attributed to mercury poisoning, which was a common occupational hazard for hat makers in the 19th century. They used mercury nitrate to treat felt, and the fumes would build up in their workshops, leading to mercury poisoning.
The symptoms of mercury poisoning include tremors, memory loss, irritability, and other mental and neurological problems, which are all consistent with the Mad Hatter's personality and behavior in Lewis Carroll's "Alice's Adventures in Wonderland."