The first known use of the name "jack-o'lantern" in print is in American Gothic writer Nathaniel Hawthorne's short story The Great Carbuncle, first published in 1835 and then in a collection of short stories in 1837.
Hide it [the great Carbuncle] under thy cloak, say'st thou? Why, it will gleam through the holes, and make thee look like a jack-o'lantern!
But where did the term jack-o'lantern come from?
There are several ideas on its origin. The Merriam-Webster Online Dictionary provides a good summary of these ideas.