It may seem like a simple question but the answer goes back not just to ancient times but also to much more recent history.
When it comes to its older roots, not all scholars agree but many trace Halloween to the Irish Celtic holiday of Samhain. It marked the end of the harvest season and was often celebrated with bonfires and feasts. The Celts believed relatives who had passed away were able to visit during this time and often left out offerings. In the 8th century, the Catholic church named the day Samhain was celebrated -- November 1 -- as All Saints Day and the day before became known as All Hallow’s Eve.
When the Puritans arrived in America, their religious beliefs prevented them from celebrating Halloween, but other colonists brought the holiday with them. Though, it didn’t really take off until an influx of Irish immigrants arrived in America during the Irish potato famine. They, along with Scottish immigrants, revived the old world custom of guising, or dressing in costumes on Halloween to perform a song or recite a poem in exchange for a treat.
By the 20th century, Halloween had surged in popularity in the U.S. but for all the wrong reasons. Revelers spent the night making mayhem and by the 1930s, the vandalism and damage was costing towns serious money. Communities started holding family-friendly Halloween celebrations, focused on children, to keep potential troublemakers too busy to do damage. It worked and Halloween parades and trick-or-treating took off.
By the 1950s, the holiday was much more about kids in costumes seeking out candy than mayhem and mischief.