City's finishing had been wasteful at Etihad Stadium before Sterling met a cross from Riyad Mahrez with a sidefooted finish from close range in the 66th minute.
Foden, also on as a substitute but only in the 90th minute, made the points safe by running onto Sterling's pass on a counterattack and shooting low into the corner with virtually the last touch of the game.
The English champions are well on their way to qualification from Group C, having started with a 3-0 win at Shakhtar Donetsk two weeks ago. They are three points clear of Shakhtar and Dinamo.
Still, City manager Pep Guardiola cut a frustrated figure during the match against Dinamo, even collecting a yellow card for complaining against a refereeing decision in the second half.
Ilkay Gundogan struck a fierce shot against the crossbar before halftime and Sergio Aguero squandered a raft of chances for City, which was barely troubled by the Croatian team.
Sterling added a spark with his directness after coming on as a 56th-minute substitute
"It needed a change of tempo and Raheem brought that well," Foden said.
City had 19 attempts on goal, but Guardiola's team lacked a cutting edge with key midfielder Kevin De Bruyne missing because of a groin injury.
"They defended very well one-on-one and were very aggressive," Guardiola said of Dinamo. "They had 10 players in the box, they didn't want to play."
Most of the noise inside the Etihad came from Dinamo's small but lively contingent of around 1,300 fans. Many of the away fans even took off their tops en masse at one point, seemingly enjoying the occasion despite the result.