According to Smithsonian.com it all began with a Celtic tradition in celebration of the end of the year. The idea was to dress us as an evil spirit. People believed that, with the changing of the year, the spirits could overlap and start to roam the earth. By dressing as one of the spirits, the real spirits would believe you were one of them and would not harm you.
In the Middle Ages, the act of trick or treating started with children in costume going door to door to beg for food or money, it was said to be for “the dead.” This was called “souling.” There was sometimes a threat of mischief if nothing was forthcoming.
“Guising” was recorded in Scotland in 1895 when costumes were worn and lanterns were made out of turnips. Cake, fruit and money were handed out to the revelers.
Trick or treating became common in North America in the 1920s and gained in popularity after the end of World War 11 after the end of sugar rationing.
Today, Halloween celebrations are almost as popular as Christmas with the sale of costumes, candy and decorations. In 2016, the National Retail Federation estimated $8.4 billion would be spent on Halloween.