When a fertile Glyptapanteles wasp is about to lay her eggs, she seeks out a caterpillar. While it is unknown if the wasp can parasitize any species, it is know to seek out at least three specific species: Lymantria dispar, the Gypsy Moth; Chrysodeixis chalcites, the Golden Twin Spot Tomato Looper; and Thyrinteina leucocerae, the Geometrid Moth. Upon finding one of these caterpillars, she stings it, injecting a paralyzing venom to keep her subject still. This is key as the wasp will then stab the caterpillar with her ovipositor and then proceeds to lay up to 80 eggs inside the caterpillar's body. Once this is finished, the wasp simply flies off leaving the caterpillar to slowly recover.
For a while the caterpillar goes back to its life of constant eating, probably wishing the previous events were just a horrible nightmare or a case of sleep paralysis. Unfortunately for our surprisingly self aware caterpillar, it did really occur and those eggs soon hatch and the larvae begin gorging on the insides of their warm squishy home. They don't go so far as to kill the caterpillar as they have need of it for later.
Eventually the larvae are are ready to pupate, but they must first exit their home/buffet. So they begin the process of eating their way out of the now somewhat hollowed caterpillar. They then spin their cocoons nearby. If evolution were merciful, the caterpillar would now be able to know the sweet embrace of death. Instead, the caterpillar actually heals its wounds and remains alive, though it is left in a somewhat altered state. It loses all interest in eating and instead focuses on the cocoons, spinning extra protective webbing around them and even charging and attacking any insect that gets to close. Why would it protect its former tormentors? The reason wasn't certain for quite a while until it was noted that some of the larvae don't leave their host. These larvae instead sacrifice themselves for the good of the many by taking control of the behavior of the caterpillar.
I'm sure you never thought you could say that you have seen a zombie caterpillar, did you?
Eventually, adult wasps emerge from their chrysalides and fly off. The caterpillar turned zombie guard dog is left to slowly starve, still watching over the empty shells.