It is thought to have originated with the ancient Celtic festival of Samhain, when people would light bonfires and wear costumes to ward off roaming ghosts. In the eighth century, Pope Gregory III designated November 1 as a time to honor all saints and martyrs; the holiday, All Saints' Day, incorporated some of the traditions of Samhain. The evening before was known as All Hallows' Eve and later Halloween. Over time, Halloween evolved into a secular, community-based event characterized by child-friendly activities such as trick-or-treating.
It was originally a Pagan holiday called Samhain, which was meant to celebrate the summer solstice, and the people set up huge bonfires and wore scary masks to ward off evil spirits. They also told futures about each other. The fires were huge, and they attracted bats, which is one of the reasons why those animals are associated with Halloween.