Jesus, again deputising for the injured Sergio Aguero, levelled before the break and grabbed two more in the early stages of the second half before Foden added a late fourth at the Maksimir Stadium.
A sweet night in Zagreb!
— Manchester City (@ManCity) December 11, 2019
The raucous home fans never gave up but Dinamo were outplayed in the second half. Defeat not only ended their hopes of reaching the knockout stages, but Atalanta's victory over Shakhtar Donetsk also cost them a Europa League place.
City made eight changes from the side beaten by Manchester United, part through necessity with John Stones and Fernandinho injured and suspended respectively, but also to rest the likes of Kevin De Bruyne and Raheem Sterling.
It took time for the game to warm up and, after a quiet opening, Dinamo struck first, delighting their unrelentingly vocal supporters with a fine goal in the 10th minute.
Damian Kadzior cut inside from the right and clipped a fine ball forward over the defence. City have been bedevilled by central defensive issues all season and they were undone again as Olmo got between Nicolas Otamendi and Eric Garcia to strike with a ferocious volley.
Ilkay Gundogan had City's first serious effort when his low strike was pushed away by Dominik Livakovic after 20 minutes but they were almost caught out again when Olmo blazed over. Mislav Orsic also forced Claudio Bravo to save.
City levelled after 34 minutes, although Dinamo were far happy. Foden, making the most of a rare start, skipped past two defenders and then broke away as Petar Stojanovic and Kadzior crunched into each other attempting to hack him down.
City played on as Stojanovic lay injured and also refused to stop after Emir Dilaver came off worst in a clash with Jesus. Riyad Mahrez picked out Jesus with a fine cross to the far post and the Brazilian headed home.
Dinamo complained and there was some pushing and shoving between players but the goal stood.
Frustrations then got the better of Gojak just before half-time when he elbowed Rodri in the face. Remarkably he escaped punishment from the referee and VAR.
City upped the tempo after the break and Jesus bagged his second after 50 minutes as he jinked through the defence after playing a one-two with Foden.
His hat-trick came four minutes later as Mendy finally delivered a decent cross and he volleyed home from close range.
He might have had a fourth soon after the pair combined again but this time he headed over from Mendy's delivery.
Jesus was taken off after 66 minutes but it was not the end of the scoring as Bernardo Silva teed up Foden for a goal his performance deserved.