Jem describes his childhood as being a caterpillar in a cocoon because he always though the citizens of Maycomb were good people, and the trial made him feel differently.
Jem’s comparison of his childhood to a caterpillar in a cocoon demonstrates that he is growing up. He realizes that the world is not the place he thought it was.
"Like somethin' asleep wrapped up in a warm place. I always thought Maycomb folks were the best folks in the world, least that's what they seemed like." (ch 22)
When Jem suggests that no one in the town helped Tom Robinson, Miss Maudie explains that many people actually did. She tells him that besides the help of the Negro community, many of the whites also supported Tom. Atticus, Miss Maudie, Mr. Raymond, Mr. Underwood, and some others are not racists. She also points out that Heck Tate and Judge Taylor also did whatever they could to help.
When Miss Maudie does not make a little cake for Jem, she is acknowledging that he is growing up. The trial was a rite of passage for him, and he is entering the adult world of reality.
Harper Lee’s To Kill a Mockingbird is all about the process of growing up and learning, sometimes the hard way, about what the adult world is really like. As kids, Jem, Scout, and Dill are sometimes clueless about what is happening in Maycomb. We see their innocence in their childish games, irrational fears, and failure to understand Atticus’ wisdom.
Following the trial of Tom Robinson, the kids are stunned. They cannot grasp how Tom could have been found guilty—they just aren’t mature enough yet to realize how differently people look at issues like race. Jem, in his anguish, believes he is beginning to understand and that he is changing as a result, like a caterpillar changes after its time in the cocoon.
Aunt Maudie, however, knows that Jem has not fully understood what is happening yet. In addition to telling Jem about all the Maycombers who helped Tom during his trial, she also tells Jem something very important about his father, just prior to his comment about the cocoon:
I simply want to tell you that there are some men in this world who were born to do our unpleasant jobs for us. Your father’s one of them.
Jem’s response to this is simply, “Oh, well.”
This response shows us that Jem still doesn’t fully understand the role his father has played in the town with his unpopular defense of Tom Robinson. Although Jem may indeed be a “caterpillar in a cocoon,” he is not yet ready to become the butterfly.
Jem's metaphoric observation in Chapter 22 certainly expresses his emergence into the adult world of the cold realities of "the evil that men do" as Marc Antony expresses the nature of people in Julius Caesar. That is, to paraphrase the passage of St. Paul to the Corinthians, when Jem was a child, he thought as a child. But now he is a young man and has "put away the things of a child...see[ing] now through a mirror in an obscure manner" (13:11-13). His cocoon has been his safe little neighborhood of which until recently he and Scout have only walked one way. Now he asks, "Who in this town did one thing to help Tom Robinson? Who?"
While he and Scout have been exposed to some of the inequities of life with the gossip of Miss Stephanie and the rumors about Boo Radley, Jem and Scout have been innocent and unaware--"like something asleep wrapped up in a warm place"--regarding racial relations in their community and state since their only exposure to African-Americans has been with Calpurnia, who has been in a position of semi-authority with them and clearly treated as an equal in their home.