Seriously, they'd even fold the leaves up and swallow them whole to avoid chewing them, like a 5-year-old who has been browbeaten into clearing his plate of broccoli. And also like the 5-year-olds swallowing greenery whole, the stuff would leave the body pretty in much the same form it came in. In the case of the chimpanzees, though, the pooped-out leaves were covered in intestinal worms.
That didn't look like a vegetable and hookworm burrito in any way at all.
Scientists found that those plants all had one specific trait in common: They were covered with trichomes -- tiny, sharp hooks that speared the undesired subtenants and gave them a slide-ride all the way down the intestine and out. Good riddance!
So, how did the chimpanzees learn to use leaves like that? Well, just like '80s teens who picked up drug habits in the home, they learned it from their parents, specifically their mothers. But then we still have to give credit to the first chimp who put two and two together ("Hey, this leaf is covered in my butt worms, let's try that again"). Imagine if you found yourself battling poop bugs in the jungle. Would you know to how to find the one plant that would clean your system out? Exactly. Chimps 1, stranded hypothetical humans who contracted intestinal worms 0.