Article taken from 'History Facts'.
The jack-o’-lantern has its roots in Irish lore — specifically, the legend of a man called “Stingy Jack,” who tried to trick the devil and suffered the consequences. There are many versions of the tale, but the gist is that Jack invited the devil for a drink but balked when it came time to pay, and asked the devil to transform into a coin he could use for payment. The devil went along with this, but Stingy Jack kept the coin for himself, putting it next to a silver cross in his pocket to keep the devil from reverting to his original form. Jack’s next move was to free the devil if he agreed not to bother Jack for a year and not to take his soul when he died. A year later, Jack once again tricked the devil, this time getting him to agree to leave Jack alone for 10 years.
After Jack died, God wouldn’t allow the trickster into heaven, and the devil, honoring his deal, wouldn’t take Jack into hell, either. The devil sent Jack away with only a burning coal from the fiery underworld to light his way. A ghostly Jack placed the coal in a carved-out turnip lantern, sentenced to roam the Earth for eternity. The Irish referred to the specter as “Jack of the Lantern,” and eventually, “Jack o’ lantern.” People even began carving out lanterns to mimic the story. The first jack-o’-lanterns were made by carving out turnips, beets, and potatoes and illuminating them with a candle. These date back at least to 1640, when author Sam Howell referenced “a turnip cut like Death’s head with a candle in’t.” Pumpkins aren’t native to Ireland, so the tradition as we know it didn’t come about until Irish immigrants brought the legend to the United States, where pumpkins had been introduced to Europeans by Indigenous people in the Americas.