Rikki-tikki gets washed away from his mongoose family in a flood and that is how he ends up with the people.
This story takes place in British-colonized India, in a house on the edge of a “half cultivated” garden. This basically means that part of it is maintained by the family but part of it is left in its wild state. Into this garden, Rikki-tikki-washes one day.
One day, a high summer flood washed him out of the burrow where he lived with his father and mother, and carried him, kicking and clucking, down a roadside ditch. He found a little wisp of grass floating there, and clung to it till he lost his senses.
The little boy whose family lives in this half-cultivated garden bungalow finds Rikki in the middle of the garden path and thinks he is dead. The mother knows he is not dead, and they pick him up and dry him off. A mongoose is very useful to have around, because a half-cultivated garden means snakes, and mongooses kill snakes. All mongooses want to be “house mongoose” someday, meaning that they will live with people.
The garden is inhabited by two cobras, Nag and Nagaina, and other snakes like Karait, the little dusty brown one. They are a threat to small creatures, like the birds, and also to the people. Therefore the people find having a mongoose for a pet convenient. When Teddy’s mother is concerned with Rikki sleeping with her son, his father explains that the mongoose is quite safe.
``I don't like that,'' said Teddy's mother; ``he may bite the child.'' ``He'll do no such thing,'' said the father. ``Teddy's safer with that little beast than if he had a bloodhound to watch him. If a snake came into the nursery now --- ''
This is foreshadowing of the trouble that the family will have with snakes, which ironically is partially caused by their fear of the threat from Rikki. The cobras, Nag and Nagaina, know that Rikki will try to kill them sooner or later. They target the family in retribution. Eventually Rikki kills Nag, and then Nagaina tries to kill him. Rikki tricks her by killing her eggs. All are examples of Rikki’s dedication to his family and his use of his instincts.
The story is largely allegorical, describing the effects of colonization on the natives and the colonizers. Even when the colonizers and the original inhabitants try to live peacefully together, conflict is inevitable. The British colonizing India is the backdrop, represented by the conflict between the people and the snakes. Rikki, washed into their lives, gave them a fighting chance, but his very presence there was a threat to the cobras and caused them to initiate hostilities against the people.
Although it is natural for the reader to feel sympathy for the cute mongoose and the people, we have to remember that the snakes were there first, and the question that Nag asks Rikki is a valid one. The snakes are not acting against their nature by eating the baby bird. They did not target the people before Rikki arrived. In these situations, the two sides cannot live peacefully side by side. They are each acting as they do, according to their natures.