Halloween has been a holiday for centuries now, and the modern celebration of it is something of a mashup of traditions derived from multiple cultures.
The most popular belief is that Halloween, or All Hallow's Eve, is the modern descendant of the Celtic holiday Samhain. The Celts believed that at this time the veil between worlds was at its thinnest, giving spirits and other spooks the ability to break free, if only temporarily, into our world. Not all of these were believed to be friendly, and so ceremonies were held to ask for protections and to honor the loved ones that had been lost.
A holiday relating to death is present in most cultures however, and the modern Halloween could be related to nearly all of them. Here's a brief history on some Halloween traditions though:
Jack-o-Lanterns: From an Irish legend, in which a boy was so mischievous that he managed to even trick the Devil. He caused the Devil to become caught in a tree, and the Devil was so enraged that once he finally came down he spent the rest of the boy's life following him whenever he passed through the forest. Jack, and others who might be targeted, took to carrying their candle in a turnip so that they might carve a face into it and ward off the evil spirit. When the Irish emigrated to America, they found that pumpkins were much more accessible and the tradition shifted itself to the commercialized version we see today.
Trick-or-Treating: Contrary to the popular belief that it was 'created by candy companies', trick-or-treating is human mimicry of what they expected of the demons that might be released into their world on Halloween. When people still feared a demon taking vengeance upon their house, they would leave offerings of meat and bread on their doorstep to appease the demon. As time progressed and superstition was lessened, children dressed as demons and the offerings became what would interest children more and the ancient tradition became a game.
Let me know if you want to know about any other aspect of Halloween.