After dominating possession with little reward, City found a breakthrough in the 36th minute when Gabriel Jesus trapped a crossfield ball and fed Raheem Sterling, who produced a sublime backheel pass for Foden to slam the ball into the net.
The Greek side stayed in the game and were not far from finding a late equaliser when Konstantinos Fortounis pulled his shot just wide of the far post from a tight angle, while defender Pape Cisse headed over the bar in added time.
City's fourth consecutive win in Europe's elite competition left them top of Group C with 12 points, while Olympiakos are third with three.
The unblemished European record of Pep Guardiola's side this season contrasts with their recent struggles in the Premier League, where they have won only three out of eight matches and were beaten 2-0 at Tottenham Hotspur last Saturday.
After failing to take their chances against Tottenham, City again lacked ruthlessness in front of goal against Olympiakos and should have built on their lead.
Sterling saw a thumping free kick tipped over the bar by Olympiakos keeper Jose Sa, who also thwarted Joao Cancelo after the break, while Bernardo Silva and Foden missed the target from clear openings.
Olympiakos nearly made them pay with their late chances but City saw the game out to make the knockouts for the eighth consecutive campaign.
"Fair play to them, they came out fighting in the second half and made it hard for us," said match-winner Foden.
"We haven't had the best results in the league but it's good we are getting the right results in the Champions League.
"We need to work on scoring more goals in games but we're creating chances, hopefully one day we'll get the goals to win games more comfortably."