The worms in the story are not portrayed as evil for eating away at the body, but instead as part of the circle of life. However, the woman in the story is so worries about her physical appearance she tries to kick the worms out of her body. This is an example of one of the seven deadly sins, pride. Could this story be giving a moral lesson on one of the seven deadly sins?
I think that, in a way, it is trying to denounce pride. Pride is presumably what is keeping this woman’s corpse from peace, and it is not until she accepts the situation that the poem is able to reach a concise conclusion. She must come to realize that even the great heroes of old must eventually die and decompose. For a pious Christian, there will come another life to which she is called to look forward. When she does this, the dreamer is able to awaken and have his story recorded.
I definitely think it can be presented as a moral lesson, against pride especially. Towards the end of the poem, soon after the lady realizes her mistake (“Alas, alas, now I know full well / That all my life I was a fool. / With a reigning pride too much to tell […]” (l. 156-7).) the worms moralize by saying “Look in holy scripture, you may behold / That the fairness of women, as therein told, / Is but a vain thing, and transitory. / But God-fearing women shall be praised as holy” (l. 173-6). The lady recognizes pride within her concern for her looks, and the worms acknowledge directly that this is a sin. After this realization, the lady and the worms resolve their dispute, and the lady awaits Judgement, fully expecting salvation because she has realized the error of her ways.
While the poem uses the pride of the body as an example, it seems to be trying to get at a bigger picture. That when we are all the same when we die, so we must relinquish our worldly ‘lusts’ in order to receive the grace of god. The intro mentions that usually in body vs soul arguments, the body represents an abstract idea of ‘the flesh’. However here we get a specific body with a specific personality, so her personality is one in which she must overcome her pride in order to fully relinquish earthly notions. I also find it interesting that the worms seem to almost be represented as pious, since they do their work of bringing people closer to god and don’t expect anything from it. In general I think the poem is more about the merits of living a godly life detached from ‘worldly lusts’ than about admonishment of sin.