Jack-o’-lanterns originated in Ireland, where for centuries people have carved turnips and other root vegetables to ward off evil spirits. When Irish immigrants arrived in the United States in the 19th century, they discovered the pumpkin, which resulted in the jolly American jack-o’-lantern that dominates Halloween imagery today.
https://www.atlasobscura.com/articles/turnip-jack-o-lanterns-are-the-root-of-all-evil