The 32-year-old will reportedly earn around €5 million per season.
His buyout clause is set at €100 million.
Aguero heads to Barcelona as the club attempts to tie down compatriot Lionel Messi to a new contract. Club president Joan Laporta said he's "moderately optimistic" the 33-year-old will re-sign.
Aguero's arrival could convince Messi to stay. The two became friends during their time with Argentina's Under-20 side and while playing together with the senior team.
City allowed Aguero to leave on a free transfer after 10 years together. He departs as a five-time Premier League winner and the club's all-time leading scorer with 260 goals in 390 matches.
Sidelined by injury and COVID-19, Aguero made just eight starts in City's double-winning campaign. He came off the bench in his last appearance Saturday in the Champions League final, which City narrowly lost to Chelsea.
Manager Pep Guardiola said Aguero still has plenty to offer despite the relative downturn in production.
"When he is fit and has continuity, he is like Romario in Brazil," Guardiola said. "In a five-meter space, he is like a lion in the jungle. He is so quick and has the quality to make the goal. For as long as he plays, he will score goals."
Barca are expected to announce more signings in the coming weeks. Memphis Depay - who's set to leave Lyon as a free agent - is reportedly in talks with the Catalan giants over a multi-year contract. Dutch midfielder Georginio Wijnaldum is also set to join the Blaugrana on a free transfer from Liverpool.