The actors star in End of Watch as two LA cops who find themselves as targets of a drug cartel after discovering a trafficking ring.
In an interview with USA Today, Peña revealed he and Gyllenhaal got off to a rocky start as friends.
"We didn't hit it off right away. He comes from a completely different background," Peña explained. "I grew up in the ghetto. He grew up in Hancock Park and his sister is an Oscar-nominated actress. My parents were farmers."
He continued: "We didn't have a lot in common. But when somebody's shooting a gun two feet away from your head, you gain a little bit of respect for them and you have to trust them."
Peña further explained that he and Gyllenhaal simply have different views on life.
"He's a complicated dude, to be honest. He's really, really smart. He can be goofy at times, but his mind is always going, going, going," the actor said. "He goes on these epic jogs. He called me up and said, 'Let's go for a run'. And there's paparazzi shots of us.
"He's running all stealth and all you see is me dying. Meanwhile, Jake is like, 'Whatever'."
Gyllenhaal previously revealed that he witnessed a murder and was tased while training with police for End of Watch.
The film is now playing in the US and opens on November 23 in the UK.
Watch a trailer for End of Watch below: