There is a misunderstanding about earthworm in the old scriptures. Many people believe worms as an expression of lust, covetousness, greed, selfishness, destruction, putrefaction, weakness, and humiliation. Most of them referred to the larva of beetles (grubs) or larva of moths (caterpillars) as pests and larva of flies (maggots) which eat directly the fresh flesh. Everything is considered disgusting because it is related to death.
In fact, all earthworms are saprovores or decomposers and they love dirt! The nutrition they eat comes from things in soil and compost, such as decaying roots, leaves and other organic wastes. In symbiotic mutualism or friendly relationship way, they eat living microorganisms such as protozoans, bacteria, and fungi in soil to be able the beneficial soil microorganisms to thrive and the plants to grow better with the additional humus layer produced by earthworms.
In the book: Opening the Door of Your Heart: And Other Buddhist Tales of Happiness (2005), Ajahn Brahm mentioned that worms are in a dirty, low-level place so they need to be saved. On the other hand, saving the worms can be considered waste time and full of risk because they think worms can bring contamination and they are dirty. Actually, salvation that is forced often shows arbitrariness and useless. Especially if the worms are happy in their habitat. Salvation is full of mystery and can be fierce.
One fictional story about earthworm started from here. There are two monks who have lived together in a monastery for years; they are good friends. Then they are getting older and died almost at the same time. One of them is reborn in the heavenly realm, the other one is reborn as a worm in a pile of dung.
The monk in heaven who is very happy and enjoying all the pleasures of heaven begins to think of his friend. “I want to know where my old friend is.” He observes all the heavenly realms and does not find any trace of his friend. Then he observes the human realm, but he does not find any trace of his friend there either. So, he looks in the animal kingdom and then lowest-level creatures on the ground.
Finally, he finds his fellow monk while in the world, reborn as a worm in a pile of dung … Wow! He thinks: “I can help my friend, sure, I will go there to that pile and bring him to the heavenly realm so that he can also enjoy the heavenly pleasures and happiness of living in this beautiful realm.”
Then he goes to the pile of poop and calls his fellow. And the little worm stretches and says, “Who are you?”. “I am your friend.” But the worm says, “Go away, you are lost!” “I am your old friend, I live in the heavenly world”, and he describes the beautiful heavenly world to him. The worm says, “No thanks, I’m quite happy here in my pile of poop. Please just go.”
Then because of the influence of the heavenly mind, the ex-monk thinks: “Well, I’ll just grab him and take him to heaven, so he can immediately see by himself.” So, he grabs the worm and begins to pull it towards him; and the harder he pulls, the harder the worm sticks to the pile of excrement.
One hundred eight times the deva (in Zoroastrianism deva means evil) tries to lead the “poor worm” out from his miserable dung pile, but the worm is so attached to his lovely pile of dung that he always wriggles back! Eventually, the deva has to go back up to heaven and leaves the “foolish worm” to his lovely pile of dung as infinite and renewable resource.
Worms are a metaphor of guilt. The guilt that departed souls experience when they leave this world. The worms indicate the pain that the deaths go through, leading to suffering after death. Moreover, historical religious events have been told in the Abrahamic (descendants of Abraham) religions using worms as the main cause behind them.
In the real world, earthworms are friends of the human race, amicus humani generis that most people, farmers, breeders, and scientists understand and have proven their role in soil fertility, as a bioindicator of soil productivity, and in resource waste management including protein production. Once it was reported by the National Geographic magazine that earthworms are the most influential species of all evolution on earth. They may save us, and save this planet through the healthy soil.