What does “he was a child who couldn’t keep his fingers out of the cookie jar” mean when talking of someone’s sexual scandal

connotationmeaningmeaning-in-contextslang

This sentence is quoted from a director's memoir, where he mentions that a famous movie star was sent to the police station because of his affair. (Thank all of you for your considerate answers. To specify this question, I'll provide the full paragraph for context)

When we got back to Munich for the interior shots, he turned into a boy; he played. Living with me in the magnificent Vier Jahreszeiten Hotel, Freddie got into trouble with a chambermaid, and late one night I had to rush to the police station and intercede for him. He was being threatened by the chambermaid’s husband; this unreasonable man was out to become famous by killing a movie star. Freddie was a child who couldn’t keep his fingers out of the cookie jar.

I used to interpret the phrase "keep one's fingers out of the cookie jar" as "resist temptation without making mistakes" (similar to "someone's hand got caught in the cookie jar.")

But today my friend told me that here, "the cookie jar" has a sexual connotation that refers to the genitals. So what is the meaning of the phrase in this context? What might have happened to this star?

Best Answer

It is a figure of speech.

The text says the actor

turned into a boy; he played
...
Freddie got into trouble with a chambermaid...

The text says nothing about actual sex, only that the maid's husband was irate enough to involve the police, but clearly Freddie is famous and likes to play grown-up games.

So the OP's bolded sentence could be

Freddie was like a child who couldn’t keep his fingers out of the cookie jar.

The idiom has been previously discussed on ELU here:
What does this phrase mean: "they just can't keep their hands off the cookie jar"?