Barry has signed a five-year contract with City after passing a medical.
The 28-year-old was expected to leave Villa this summer as his contract was due to expire next summer.
“I’m delighted to be joining City. It didn’t take much persuasion from Mark Hughes, they are heading in the direction I want to go,” Barry told the club’s official website.
“There is great potential here, and I’m sure there will be a few more additions to the squad this summer.”
“Gareth is widely acknowledged as one of the top midfielders in the Premier League, and that is a recommendation in itself,” said City manager Mark Hughes.
“When players of his quality become available then you have to be in the market for them, so we are absolutely delighted that we have been able to conclude this deal.
“The experience required to compete with the best in the Premier League is vital, and with Gareth we get the experience of someone who has played week-in, week-out in the hardest league in the world.
“He plays at a level that has an impact on the game, and we are thrilled that he is joining us.”