Where does the term tam-o’-shanter come from and What does tam-o’-shanter mean?

Robert Burns, the national poet of Scotland, wrote of the wild ride of Tam o’Shanter (Tom of Shanter), when Tam rode through a furious storm “whiles holding fast his gude blue bonnet.”

Tam’s bonnet, presumably, was the wide floppy hat favored by the Scottish Lowlanders and faintly resembling a beret.

Just why is not clear, but some time after Burns’ poem was published, the name of its hero became applied to this type of headgear, and the association remains down to the present, although now often abbreviated to “tam,” or at times “tammy.”