The incident happened at about 11:30 p.m. Wednesday on the 5700 block of Second Avenue at Van Ness Park during an anti-gang event called Summer Night Lights.
LAPD officials said bullets grazed the victim above his lip and on an arm. He was taken to an area hospital where he was listed in stable condition.
Gyllenhaal and Pena were on a ride along with Los Angeles police officers overnight to do research for a movie the two are working on. The film, "End of Watch," is about two police officers and their long-term relationship.