The Citizens headed to a rainy Liberty Stadium aiming to continue their push for an unprecedented quadruple and rotated, with Nicolas Otamendi, Fabian Delph, Riyad Mahrez and Gabriel Jesus coming in.
City dominated the opening stages but it was Swansea who took the lead after 20 minutes. Connor Roberts got the wrong side of Delph before crudely being cut down in the box for a penalty, allowing Matt Grimes to step up and fire in convincingly.
It was 2-0 just before the half-hour mark and it was former City man Bersant Celina who doubled the advantage. The Swans moved the ball back to front with ease, Kristoffer Nordfeldt starting the move and Celina finishing with a brilliant curling effort. The visitors were reeling, squabbling between themselves as they went into half-time adrift.
Pep Guardiola initially stuck with the same XI but blinked after the hour as Oleksandr Zinchenko, Raheem Sterling and Sergio Aguero were introduced to the fray.
The pressure told on 69 minutes when Bernardo Silva arrowed in an effort from the left edge of the box to start the comeback.
City piled on the pressure but rode their luck and were fortunate to be given a penalty when Sterling went down under what appeared a clean challenge from Cameron Carter-Vickers. Aguero's resulting spot-kick cannoned off the post but still went in off the unfortunate keeper.
Inevitably, the Argentine grabbed the winner with two minutes left, heading home Bernardo's cross, despite Aguero appearing offside. Controversy reigned but City won't care as they progress 3-2 and the quadruple dream remains alive.