The caterpillar is mentioned in chapter 4 and 5 of the book "Alice's adventures in the Wonderland".He is sitting on a mushroom while smoking a hookah when Alice first meet him. Although he is rather strict and not very friendly, and corrects Alice's recitation of a poem, he does help her by advising her to eat from mushroom if she wants to change her size.
The Caterpillar teaches Alice how to cope with the difficulties she encounters in Wonderland. He doesn't actually have a name, he is just being referred to as "The Caterpillar". Alice doesn't like The Caterpillar when they first meet, because he doesn't immediately talk to her and when he does it is usually in short sentences or difficult questions.
He asks Alice to repeat the poem "You are old, father William", which comes out rather strange like many of the nursey rhymes Alice attempts in Wonderland. The Caterpillar then tells Alice how to grow and shrink by eating the mushroom upon, which he is sitting.
Because the Caterpillar is smoking a hookah and advises Alice to eat from a mushroom, he is the main reason why many people think that the story of Alice in Wonderland contains hidden meaning to drugs when writing the book.