The England man, whose contract at Villa was set to expire next year, nearly joined Liverpool last summer but the Reds couldn’t meet Villa's financial demands.
City, who are owned by big-spenders Abu Dhabi Group limited, found no difficulty in making Villa the right offer for Barry, who's delighted to have sealed the move.
"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."
From his side, City manager Mark Hughes expressed his delight at capturing Barry.
"Gareth is widely acknowledged as one of the top midfielders in the Premier League, and that is a recommendation in itself," noted 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," he added.