Upon trying to tackle their increasing population of monkey's, villagers had placed rice grains inside the hollows of coconuts which were tethered to a chain. The desired result was that the monkeys would then trap themselves, and the villagers would then dispose of the monkeys.
In essence, the monkey's would grab the grains of rice, and upon trying to remove their hand from the coconut hole, the monkey's would subsequently become trapped by their own fist. Since the hole was just big enough so that the monkey can put his hand in, and too small for his fist to come out after it has grabbed the rice, the monkey's ended up trapping themselves. Rather than letting the grains of rice go and escaping, they chose instead the rice to their own peril.