Teams working at Humboldt University in Berlin were trying to work out why a tree had been scarred.
A secret camera was set up which showed the animals banging and throwing rocks against trees.
Scientists believe this is a worship ritual. They say some of what has been observed is similar to the behaviour of early human worship.
Researcher Laura Kehoe said: "This represents the first record of repeated observations of individual chimpanzees exhibiting stone tool use for a purpose other than extractive foraging at what appear to be targeted trees.
"The ritualized behavioural display and collection of artefacts at particular locations observed in chimpanzee accumulative stone throwing may have implications for the inferences that can be drawn from archaeological stone assemblages and the origins of ritual sites."
"Incidentally, chimpanzee accumulative stone throwing and the subsequent aggregation of tools at particular trees shares two important features with human ritual practices: the strong association to a particular location or site with a collection of artefacts over time, and ritualized behaviour patterns."
She said human history shows how sites have been used as a ritual to praise God and that what the chimpanzees were doing is similar.