According to folklore, after Jack died, he was denied entrance to Heaven because of his evil ways, but he was also denied access to Hell because he had tricked the devil. Instead, the devil gave him a single ember to light his way through the frigid darkness. The ember was placed inside a hollowed-out turnip to keep it glowing longer.
The Irish used turnips as their "Jack's lanterns" originally. But when the immigrants came to America, they found that pumpkins were far more plentiful than turnips. So the Jack-O-Lantern in America was a hollowed-out pumpkin, lit with an ember.