Trick-or-treating became popular in the United States thanks to the influence of 19th century Irish immigrants. It has roots in the ancient Celtic festival of Samhain.