Gyllenhaal starred alongside Jennifer Aniston, who was married to Pitt at the time, in the film. Aniston played a woman who has an affair with a younger colleague, portrayed by Gyllenhaal.
“I was definitely starstruck when I first met Brad Pitt on the set of The Good Girl,” Gyllenhaal told W magazine in a recent interview.
“I was working with Jennifer Aniston, who was his wife at the time, and there were a lot of very racy scenes.
“I remember putting my hand out to shake his, and accidentally hitting the door. He said, so confidently and kindly, ‘Well, you have another one. It’s all right.’
“He was very, very, very sweet to me, and it was actually a really lovely exchange.”
Last year, Gyllenhaal described filming sex scenes with Aniston as “torture” as he explained the difficulties actors face while trying to make a scene look realistic.
The actor, who has previously revealed in interviews that he had a “crush” on the Friends star, said: “[Filming the sex scenes] was torture, yes it was,” Gyllenhaal said. “But it was also not torture. I mean, come on, it was like a mix of both.
“Weirdly, love scenes are awkward, because there are maybe 30, 50 people watching it? That doesn’t turn me on.”