Kompany, who had not played since damaging his thigh in a Champions League semi-final against Real Madrid on May 4 and has experienced an injury-hit City career, departed during the dying seconds of the EFL Cup tie.
Goals from Gael Clichy and Aleix Garcia ultimately sealed the deal for City but substitute Gylfi Sigurdsson pulled one back for Swansea in injury time, after which Kompany departed down the players' tunnel as the home side pushed in vain for an equaliser via a last-gasp corner.
City manager Pep Guardiola said: "The doctors are speaking with him and seeing what's up.
"Hopefully, it will not be a big problem. We're going to wait for the results from the doctors."
mercurial vapor v red Asked if he had spoken with Kompany, Guardiola added: "No, not yet.
"(His performance) was good. It's not easy after a long, long time without playing. Defensively, he was so strong - he played really good.
"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."
City recorded their ninth successive win under Guardiola, seeing off Swansea 2-1 despite starting with a team that showed nine changes following last weekend's 4-0 win against Bournemouth.
Swansea, who have now gone four league and cup games without a victory, had their moments in an entertaining encounter but the visitors had an extra touch of class about them.
16+ PureChaos white They were also helped by second-half substitute Kevin De Bruyne's introduction as they moved into the last 16 three days before facing Swansea again, when Premier League points will be at stake.
"(Garcia) played good, and I want to congratulate the young players tonight. They played good," Guardiola said.
superfly v red "Fernando made an amazing effort, because he had been injured for the last two weeks. He played a fantastic game."
Swansea manager Francesco Guidolin, meanwhile, praised his players after they delivered a vastly improved display following last Sunday's tame 1-0 defeat against Southampton.
"I am disappointed because I think we deserved another result," he said.
"We deserved to draw and take it to extra time. The game was well-balanced and the performance of my team was good.
mercurial superfly cr7 blue "It is not a good moment for us. Little things are going against us, we are missing chances.
elastico superfly black "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."
Asked whether he was feeling any pressure after the Swans' recent run of results, he added: "It has not affected me.
"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."