The term jack o' lantern originally referred to night watchmen, who carried lanterns as they patrolled.
Wikipedia does offer this interesting origin myth:
Another version of the myth says that Jack was getting chased by some villagers from whom he had stolen, when he met the Devil, who claimed it was time for him to die. However, the thief stalled his death by tempting the Devil with a chance to bedevil the church-going villagers chasing him. Jack told the Devil to turn into a coin with which he would pay for the stolen goods (the Devil could take on any shape he wanted); later, when the coin/Devil disappeared, the Christian villagers would fight over who had stolen it. The Devil agreed to this plan. He turned himself into a silver coin and jumped into Jack's wallet, only to find himself next to a cross Jack had also picked up in the village. Jack had closed the wallet tight, and the cross stripped the Devil of his powers; and so he was trapped. In both myths, Jack only lets the Devil go when he agrees never to take his soul. After a while the thief died, as all living things do. Of course, his life had been too sinful for Jack to go to heaven; however, the Devil had promised not to take his soul, and so he was barred from hell as well. Jack now had nowhere to go. He asked how he would see where to go, as he had no light, and the Devil mockingly tossed him an ember that would never burn out from the flames of hell. Jack carved out one of his turnips (which was his favourite food), put the ember inside it, and began endlessly wandering the Earth for a resting place. He became known as "Jack of the Lantern", or Jack-o'-Lantern.Happy Halloween.