Like many popular modern day holidays, the origins of this day are Pagan mixed with a touch of Christian influence.
On this day, as well as the very closely celebrated Dia De Los Muertos, the veil between the physical and spiritual worlds is thinner.
In order to deceive the spirits, people darkened their faces with ashes from the bonfires (originally known as bone fires from which they burned the bones of cattle they slaughtered for winter supply) and this later developed into wearing masks. A living person would recognize the spirit of a loved one and could then reveal themselves but otherwise remain safe from the unwanted attention of darker forces.
The bowls of food (candy now) outside were originally for visiting spirits and would contain foods as offerings particular to their personal taste.
The jack-o’-lantern stems from an old Irish folktale of a man named Jack, who played a series of tricks on the Devil. Banished from both heaven and hell, the man’s eternal soul roamed the earth, guiding his way with a lantern carved from a turnip and lit with a piece of burning coal, courtesy of the Devil. People began to carve their own lanterns with scary faces to ward off evil spirits like old Jack, and "Jack of the Lantern" became what we know as the smiley-faced pumpkin set outside to light the way of revelers on the night of Halloween.