Pep Guardiola will be reunited with Lionel Messi – with whom he won two Champions League titles – after Manchester City were drawn to play Paris Saint-Germain in this season’s group stage.
The European giants are joined in Group A by RB Leipzig and Belgian champions Club Brugge.
Chelsea – who beat Manchester City in last season’s final to lift their second Champions League trophy – will play Juventus, as well as Russian champions Zenit and Swedish champions Malmo.
Liverpool have been drawn into a tough Group B, where they will take on three-time runners-up Atletico Madrid, seven-time winners AC Milan and two-time winners Porto.
Manchester United face a rematch with Villarreal, who beat them on penalties in the final of last season’s Europa League. Also in Group F are Atalanta and Swiss champions Young Boys.
Bayern Munich and Barcelona – who have won 11 Champions Leagues between them – headline Group E. Barcelona will be competing in the competition without Messi for the first time in 17 years.
Also in Group E are Benfica and Ukrainian title-winners Dynamo Kiev.
Real Madrid – who have won the competition a record 13 times – will take on Italian champions Inter Milan, as well as Shakhtar Donetsk and Sheriff Tiraspol, who are the first Moldovan side to compete in the Champions League.
Group C contains Portuguese champions Sporting, Borussia Dortmund, four-time Champions League winners Ajax and Besiktas.
In Group G, French title winners Lille face Sevilla, Austrian champions Red Bull Salzburg and Wolfsburg.
The group stage begins on September 14 and 15, with the final being held in St Petersburg on May 28.
Champions League group-stage draw
Group A: Manchester City, Paris Saint-Germain, RB Leipzig, Club Brugge
Group B: Atletico Madrid, Liverpool, Porto, AC Milan
Group C: Sporting, Borussia Dortmund, Ajax, Besiktas
Group D: Inter Milan, Real Madrid, Shakhtar Donetsk, Sheriff Tiraspol
Group E: Bayern Munich, Barcelona, Benfica, Dynamo Kiev
Group F: Villarreal, Manchester United, Atalanta, Young Boys
Group G: Lille, Sevilla, Red Bull Salzburg, Wolfsburg
Group H: Chelsea, Juventus, Zenit, Malmo