Samhain is a Gaelic festival marking the end of the harvest season and the beginning of the dark half of the year, winter. This falls about halfway between the autumn equinox and winter solstice. It is one of the four quarter days associated with Gaelic festivals along with Gaelic seasonal festivals along with Imbolc, Beltane, and Lughnasa. First mentioned in the earliest Irish literature, from the 9th century, and is associated with many important events in Irish mythology.
To honor the deceased and ward away evil spirits Celt’s would carve jack-o’-lanterns from beets, turnips, and potatoes to hold lumps of burning coal from the town festival bonfire on their front porches.
Legend says that Stingy Jack lived in Ireland and was an unpleasant drunken and miserable old man. He had met the devil twice and gotten the better of him both times. When Jack died he was not allowed into Heaven or Hell.
He became a wandering ghost and the devil tossed him a burning coal ember from Hell that he placed in a carved turnip for light, the first jack-o’-lantern. In time people would replace the coal with a burning candle.
It seems that when the Irish migrated to the United States they found that pumpkins were more readily available than turnips. This seems to be the reason pumpkins became popular along with their size, making carving much easier.