The La Liga side had taken the lead when Joe Hart spilled Giuseppe Rossi’s shot into the path of the onrushing Cani, who slotted his effort under the City goalkeeper.
But Roberto Manciniâ€™s side equalised just before half-time when Carlos Marchena turned Aleksandr Kolarovâ€™s shot past his own goalkeeper, before Aguero popped up deep into stoppage time to secure a crucial win for City.
The home side were generally unimpressive as they failed to replicate their scintillating league form on the European stage – and they fell behind after just four minutes Villarreal.
David Silvaâ€™s sloppy pass was intercepted and former Manchester United striker Rossi manufactured enough space to unleash a low shot which Hart could only parry into the path of Cani, who duly fired home.
City, visibly stunned by the early setback, looked lacklustre and it was left-back Kolarov who appeared most likely to manufacture an opening for Manciniâ€™s men.
The Serbia international fired a fierce shot from distance just wide of the left post after 12 minutes, before testing Diego Lopez with a curling effort which the Villarreal goalkeeper just managed to tip over the crossbar.
City enjoyed 60 per cent of the possession in the first half and the pressure finally told when they conjured an equaliser two minutes before the interval.
Unsurprisingly, Kolarov was central to the goal and it was the defenderâ€™s cross which sent the Villarreal defence into disarray as Marchena turned the ball into his own net under pressure from City striker Edin Dzeko.
Despite the fortunate manner of their equaliser, City struggled to seize control of the game and remained cautious after the break.
Rossiâ€™s teasing run was rewarded by a pass from Jonathan De Guzman but the lethal striker could only find the side netting with his shot.
The Italy international troubled Cityâ€™s defence moments later when his low effort forced Hart into a uncomfortable save.
Mancini, sensing the growing agitation amongst the City supporters, introduced Aguero for defensive midfielder Nigel De Jong with 30 minutes remaining.
Ageuroâ€™s pace and trickery tested the ailing Villarreal defence but the best opportunities fell to Dzeko as the game edged towards its conclusion.
The Bosnian, who endured a fairly quiet night, could only direct a right-footed effort into the side netting after excellent build-up play from his striker partner Aguero.
And moments later he spurned another chance as he nodded a delicious Kolarov cross harmlessly wide.
With Mancini growing increasingly frustrated on the sidelines, Cityâ€™s moment finally came in the 94th minute.
Substitute James Milner played a subtle pass to Zabaleta, who fired a low ball across the Villarreal box – and Aguero was on hand to score his first Champions League goal for City and secure the clubâ€™s first win in the competition.
The result leaves City in third in Group A but closes the gap on second-placed Napoli to a single point.
“I said before the game it was important to win and I think we deserved to because we had a lot of chances to score. But Villarreal were very dangerous on the counter-attack because they play football very well.
“When you play in the Champions League for the first time you need to improve game after game. We needed to win and I think tonight after this game we can do better.
“We conceded a goal after two minutes and after that the game was difficult but we scored an equaliser and had chances in the second half. In the end I think we deserved to beat them.
“Everything is now open as far as topping the table is concerned.”
Manchester City: Joe Hart, Vincent Kompany, Aleksandar Kolarov, Joleon Lescott, Pablo Zabaleta, Adam Johnson (Gareth Barry, 40), Nigel de Jong (Sergio AgÃ¼ero, 62), Samir Nasri (James Milner, 80), Yaya TourÃ©, David Silva, Edin Dzeko.
Villarreal: Diego LÃ³pez, Christian Zapata, Carlos Marchena, CatalÃ¡, Gonzalo, Jonathan De GuzmÃ¡n (Marcos GullÃ³n, 88), Cani (Mario Gaspar, 82), Borja Valero, HernÃ¡n PÃ©rez (Wakaso, 80), Bruno, Giuseppe Rossi.
MORE: Man United latest news
MORE: Arsenal latest news
MORE: Chelsea latest news
MORE: Liverpool latest news