You are referring to Ch. 8 when Jem tells Atticus all about their activities related to Boo. Jem confesses all of this to Atticus to protect Boo because he does not want him to get in trouble for putting the blanket on Scout.
Atticus wants to return the blanket to the Ridleys, but Jem immediately begins to tell him everything as a result. It does seem a little strange that Jem would confess everything because up to this point he has been very secretive about their game, and even when Atticus told them not to play it, Jem found ways to keep doing so.
"Jem seemed to have lost his mind. He began pouring out our secrets right and left in total disregard for my safety, if not for his own, omitting nothing, knot hole, pants, and all" (Ch.8).
However, that night he recognizes that Boo put himself at risk by leaving the house to come and cover up Scout. He has heard stories about Nathan Radley, but he and Scout have also seen his irrational behavior first hand, and he does not want Boo to get in trouble for doing something nice for them. The only way he can explain to Atticus the threat that Nathan poses and why they cannot return the blanket is to be forthright about all of the kids' antics.
This is also a moment in the book where we see Jem maturing. He chooses to step forward and do the right thing despite the risk of punishment for himself.