Legend
Buddhism and Taoism are basic the two largest religions no matter in China or in Taiwan. For the Ghost Festival, there are two different origins, one from buddhist people, and the other from the Taoist people.
.
In this Buddhist legend, the protagonist Moginlin learns that his mother's ghost is being tortured in Hades by starvation and hanging and thus embarks on a grueling journey to the underworld bringing food to ease her hunger. When he finally succeeds in finding his mother, Moginlin offers the food to her but it erupts into flames before she swallow. He is so despairing, and he begs Sakymuni to show him a way to bring salvation to his mother. The Buddha tells him, "It is impossible for you to save her by your own. You must try to find ten monks and pray together on the 15th day of the seventh moon." Following the Sakymuni's instructions, Moginlin begins a ritual Buddhist fast and chants the sutras until finally he succeeds in releasing his mother from hell. This legend has been told through the ages and is celebrated on Chung Yuan by Buddhists around the world, holding ceremonies of charity. Thus, the 15th day of the seventh moon has become an occasion for teaching the virtues of filial piety.

For Taoist people. Ghost Festival is celebrated on the 15th day of the seventh moon, called "Chung Yuan," and Chung Yuan falls between Shang Yuan on the 15th of the first moon, known as the day the Ruler of Heaven bestows fortune; and Hsia Yuan on the 15th day of the tenth moon, when the Ruler of Water alleviates suffering. For this reason, generous sacrifices are prepared for the Ruler of Earth and to ancestors during Ghost Festival.