Kompany - back after a five-month injury lay-off - left the field by his own choice in injury time after City had made all three substitutions.
Gael Clichy's fourth goal in English football had put City in charge before Aleix Garcia swept home a second.
Swansea's record signing Borja Baston missed several chances before Gylfi Sigurdsson scored a late consolation.
Belgian centre-back Kompany sat out Euro 2016 and had not played since injury forced him off in City's Champions League semi-final defeat by Real Madrid on 4 May.
"The doctors are speaking with him, but hopefully it is not a big, big problem. We're going to wait for the result," said City manager Pep Guardiola.
"Once they scored the goal, after I said: 'What happened?'. They said that Vincent had gone to the locker room. Hopefully, it will not be a big problem. We will have to wait. If he's injured, he's injured. He cannot stay on the pitch."
"It's not easy after a long, long time without playing. Defensively, he was so strong - he played really good."
Both sides rang the changes for this game but City showed they have the depth to compete in all competitions  - despite Guardiola scoffing at the notion of winning four trophies - with the likes of Kompany, Pablo Zabaleta and John  Stones restored by the Spaniard.
Swansea made eight changes themselves, and starts for the likes of Jay Fulton and defender Kyle Naughton, as a winger, gave their team an experimental look.
A close first half saw chances limited, but City surged ahead after the break through Clichy's deflected goal and might have added to Garcia's smart second after Jesus Navas' pinpoint cross.
City twice came close to gifting the Swans a goal, but Borja was denied by Willy Caballero either side of half-time, before Sigurdsson's late consolation effort from close range.
Swansea manager Francesco Guidolin:
"It is not a good moment for us. Little things are going against us, we are missing chances.
"Manchester City are a very good team, even though they changed their players around. But I am optimistic, as I saw my team play a good game.
"This is my job. With my experience, I know football is like this. it does not bring any added pressure for me. I have to work with my players, my staff and to pick up better results."
Match ends, Swansea City 1, Manchester City 2.
Second Half ends, Swansea City 1, Manchester City 2.
Corner,  Swansea City. Conceded by Tosin Adarabioyo.
Goal!  Swansea City 1, Manchester City 2. Gylfi Sigurdsson (Swansea City) left footed shot from the centre of the box to the bottom left corner. Assisted by Modou Barrow.
Attempt missed. Modou Barrow (Swansea City) left footed shot from outside the box is close, but misses the top left corner.
Substitution, Manchester City. Tosin Adarabioyo replaces Aleix García.
Corner,  Swansea City. Conceded by Vincent Kompany.
Fernando (Manchester City) is shown the yellow card for a bad foul.
Leon Britton (Swansea City) wins a free kick in the defensive half.
Foul by Fernando (Manchester City).
Attempt saved. Jay Fulton (Swansea City) right footed shot from the right side of the box is saved in the bottom right corner.
Corner,  Swansea City. Conceded by Aleix García.
Foul by Leon Britton (Swansea City).
Brahim Diaz (Manchester City) wins a free kick in the defensive half.
Modou Barrow (Swansea City) wins a free kick on the left wing.
Foul by Gaël Clichy (Manchester City).
Substitution, Manchester City. Brahim Diaz replaces Kelechi Iheanacho.
Foul by Mike van der Hoorn (Swansea City).
Leroy Sané (Manchester City) wins a free kick in the defensive half.
Corner,  Manchester City. Conceded by Jay Fulton.
Attempt blocked. Kevin De Bruyne (Manchester City) right footed shot from outside the box is blocked.
Corner,  Swansea City. Conceded by Pablo Zabaleta.
Substitution, Swansea City. Modou Barrow replaces Borja Bastón.
(Manchester City) wins a free kick in the attacking half.
Foul by Mike van der Hoorn (Swansea City).
Corner,  Swansea City. Conceded by Pablo Zabaleta.
Attempt saved. Kevin De Bruyne (Manchester City) right footed shot from the centre of the box is saved in the bottom right corner.
Goal!  Swansea City 0, Manchester City 2. Aleix García (Manchester City) left footed shot from the centre of the box to the bottom left corner. Assisted by Jesús Navas.
Attempt missed. Borja Bastón (Swansea City) right footed shot from the left side of the box is close, but misses the top left corner.
Foul by Leroy Fer (Swansea City).
Aleix García (Manchester City) wins a free kick in the attacking half.
Attempt saved. Borja Bastón (Swansea City) right footed shot from the right side of the box is saved in the bottom right corner.
Substitution, Swansea City. Gylfi Sigurdsson replaces Kyle Naughton.
Kyle Naughton (Swansea City) wins a free kick on the left wing.
Foul by Gaël Clichy (Manchester City).
Attempt missed. Aleix García (Manchester City) left footed shot from outside the box is just a bit too high.
Substitution, Manchester City. Kevin De Bruyne replaces Angelino.
Substitution, Swansea City. Leroy Fer replaces Jack Cork.
Kyle Naughton (Swansea City) is shown the yellow card for a bad foul.
Corner,  Swansea City. Conceded by Fernando.
Vincent Kompany suffered an injury scare on his return as Manchester City eased past Swansea in the EFL Cup.