In the last scene of The Babadook when Amelia takes worms downstairs to the babadook:
Why is it there? Is it by choice or is it a captive?
How did telling it not to harm her son drive it off?
The Babadook is really a metaphor for the mother's grief.
Once summoned, it initially possesses the mother leading to her becoming a monster of sorts, treating her son badly and hurting the family pet.
This continues throughout the movie, this problematic mix of the "good" mother and the Babadook mother which controls her dark thoughts and feelings. When the neighbour vists, she tells the mother that she loves her and her son and would do anything to help them. This, coupled with her son's own words ("you don't love me anymore, but mummy... I still love you"), enable her to finally take control of her grief and she "expels" the Babadook by telling it not to hurt her son (i.e. by taking control of her emotions).
It then leaves and goes to the basement - the place where her dead husband's belongings all are (i.e. the room of the past).
We know the mother can visit this room with her dead husband's belongings to gain a sense of closure. Similarly, she can now visit (and even look after) those dark thoughts and feelings she once had towards her son - her grief. In other words, rather than the Babadook being a real evil creature, the evil inside her is what drove her actions. Once she took control of that and moved past her grief, she was able to proceed with her life.
So by telling it not to harm her son, she took control of her emotions and thus "drove" it away. The worms was just a symbolic way of showing how she was now in control of her emotions and happy (as the following birthday scene showed) as opposed to still living in the past, consumed by grief.
Here's a non metaphorical explanation, just an idea I had:
Remember when she went down to the basement and saw her husband The first time? He then asked for "the boy" so that they could be together again. This kind of reminds me to the voodoo spells where a spirit invades and takes over a body, (like in The Skeleton Key).
My theory is that the spirit of her husband was the babadook. The movie implies that the father was a magician, perhaps he was involved in darker subjects like witchcraft or voodoo and built some sort of spell in the book so that he could come back.
I think that the mother did in fact gave the boy to the babadook (the father) so that it could take over the boy's body. The boy's spirit in turn got locked in the babadook which got scared and went down to hide in the basement.
In the final scene we see the mother and son very happy, like nothing happened. We see the boy do some pretty impressive and fancy magic tricks which are way too complex for his age. When she's taking the worms to the babadook she tells the son not to come in the house, probably because they fear that the babadook (now Sam) will take over his body again.
The babadook is no longer as aggressive as before, it calms down when it hears the motherly voice and retreats pretty fast. This might be an indication that perhaps Sam is now trapped in the babadook and her sicko mother and father plan in leaving him down there for ever.
If we want a non-metaphorical (aka literal) interpretation of the Babadook, then we start with the assumption that the monster is real. If the monster is real, it stands to reason that the poem in the book is also real, and accurately telling us the rules by which the monster lives. (They tried to destroy the book several times and it kept coming back, so the book is clearly supernatural itself, and tied to the monster.)
In the last scene of The Babadook when Amelia takes worms downstairs to the babadook: Why is it there? Is it by choice or is it a captive?
"If it's in a word or it's in a book / you can't get rid of the Babadook."
The monster is effectively immortal. You can't get rid of it entirely, once you've let it in.
How did telling it not to harm her son drive it off?
"I'll make a wager, yes / I'll make a bet / The more you deny me / the stronger I'll get"
The Babadook becomes stronger when people deny its existence.
At first, the mother tells Sam the monster isn't real and denies the strange things she sees. This gives the monster power over her and allows it to possess her, doing progressively scarier things.
At the end of the movie, she screams at the Babadook and tells it to leave her son alone. By addressing the monster directly like this, she is implicitly showing that she believes it's real, and so it loses its hold over her and retreats.
To stay safe from the monster, they have to acknowledge that it exists. Feeding it, like a pet, is a way of continuing to acknowledge its existence so that it doesn't come back. (Besides, it killed their dog.) If they ignored it, they might begin to believe it was all some sort of dream or hallucination, which would allow it to return.
As far as "why worms" specifically... why not worms? What do you feed a scary black shadow monster anyway? It was probably Sam's idea.
Note: I do like a lot of the metaphorical answers already given. The movie has a lot of potential in the metaphorical arena. This answer is predicated on the idea that we want a literal explanation of events as they were presented.
One of the things I enjoy about the film is that many meanings can be read into the storyline. Is it a story of madness, or are the events supernatural? From a purely psychological point of view, there are many obvious cues. To point out a few:
Despite the mother's argument that she is over the death and loss of her husband, this is clearly not the case from her dreams, and her relationship with her son. The alienation of her friends also points to the perspective of others who have known her since her husband's death, and their frustration with what they see as an inability to move on with her life.
The physical distance and abhorrence of being touched by her son, and that they never celebrated the son's birthday(it being the anniversary of her husband's death) points to unresolved emotional issues.
The mother's implied involvement to the events, such as the appearance of the book(she previously wrote children's stories), and the appearances of the entity only to the mother(the son fears it, but all manifestations of violence towards the son are through the mother once it is "inside" her).
The hallucinations in front of the television, hearing voices, disassociation with others, and the frequent loss of time all appear to be symptoms of a mental disorder.
The psychological premise said, what about a supernatural meaning? Is the Babadook an evil entity or demon?
The spiritual author Alexandra David-Neel wrote of the "tulpa" in Tibetan mystical lore, an entity created by the mind, either intentionally or not, which once created could be very difficult to return to nothingness. Did the horrific event of the husband's decapitation in the auto accident, coupled with years of dwelling on the death of her husband, and her son as an ever-present reminder, create the medium for the growth of such an entity? Interestingly, when she finally confronts the babadook it runs back to the basement, where all of her husband's cherished belongings, and her memories of them together, are kept; as if that is it's home(and where it was perhaps born).
The babadook had an appetite for small things: the life of the small dog, the child, and worms. Did it need to feed on the life force of small living things to continue to manifest itself? Why does the mother need to continue to "feed" the babadook live things to keep it satiated?
Poltergeist phenomena is often argued to be generated by sexual energies from those in puberty. The question of incest was raised in the famous "entity" case (that was the basis for the movie of the same name). In the real-life events that inspired the film "The Exorcist", the relationship between the possessed boy and his aunt, again incestuous questions were raised.
In the film, the mother is very uncomfortable with the boy's need to touch her. With no outlet in her life for her sexual needs, and her other emotions of frustration, alienation, and anger also being repressed, could the entity have been feeding off this energy as well?
The persistence in the storyline that the babadook needed to be let in. The knocking/banging on the front door, opening of doors, the re-appearance of the previously destroyed book on the front doorstep, and even the clear statement in the book itself "Let Me In" and the boy's warnings about this, parallel demonic lore about this requirement.
The weakness of the babadook when faced with positive emotions and loving bonds. Demonologists believe that an evil spirit feeds on negative emotions, and that individuals feeling alone, isolated, and without familial support are ideal targets for demonic forces at work in such cases. Although the son was originally fearful of the babadook, he immediately devised ways to protect his mother from it. Despite the child being portrayed early on as the troubled one, it was the mother that proved the most emotionally and psychologically fragile, and it was she that became the focus of the babadook.
The mother was feeling isolated and without any lasting support from her extended family or coworkers, and society as well (school officials, social workers, police, and even strangers in public). The only human bond is her son who she is emotionally distant from due to the tragic circumstances surrounding his birth(some argue that dark spirits are in fact drawn such events). Even her dog begins to distrust her.
Positive emotions ultimately turned the tide. The mother had an obvious caring relationship with old woman next door, and when the lady stated her love for the mother and son, she was no longer in her mind alone. The son's expressed devotion to his mom and determination to purge her of the babadook once it was inside her together, in the end proved too much for the entity.
Psychosis or evil spirit, The Babadook is definitely a very original horror tale.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?