Cotton candy was invented in 1897 by William Morrison and John C. Wharton, candymakers from Nashville, Tennessee, USA. They invented a device that heated sugar in a spinning bowl that had tiny holes in it. It formed a treat that they originally called "Fairy Floss." As the bowl spun around, the caramelized sugar was forced through the tiny holes, making feathery candy that melts in the mouth.
Morrison and Wharton introduced cotton candy to the world at the St. Louis World's Fair (1904) and sold huge amounts of it for 25 cents a box (that was a substantial amount of money back then). They sold about 68,655 boxes at that fair. The term "cotton candy" began to be used in the USA around 1920. In the United Kingdom, this treat is called "candy floss."