Bayern chairperson Karl-Heinz Rummenigge reached a deal with Fiorentina president Andrea Della Valle on Monday, with contracts to be finalised and signed in the coming days, the Bundesliga club announced on its website on Monday.
"It was Mario Gomez's wish to leave Bayern in the direction of Florence. We've now granted his wish," Rummenigge said.
Gomez joined Bayern from Stuttgart for a then Bundesliga record fee of up to $45-million in 2009.
Bild and Kicker both reported Fiorentina will pay Bayern $26-million for the 27-year-old forward. Bild said the Italian side will pay $20.6-million up front, with the rest to follow later.
Gomez scored 112 goals in 172 games for Bayern.
"With that he made a major contribution to two German titles and and two German Cup wins. The highlight, of course, was the Champions League win and the treble last season," Rummenigge said.
"I want to thank him for his performances for Bayern. On behalf of the club I wish him lots of luck and success in Florence."
Bayern's wish to sign Lewandowski
Injury ruled Gomez out of Bayern's opening games to last season, and he was unable to reclaim a regular starting place due to Croatian striker Mario Mandžukić's good performances and coach Jupp Heynckes' policy of rotation.
Bayern has made no secret of its wish to sign Robert Lewandowski from Bundesliga rival Borussia Dortmund, and Gomez reportedly felt a move away from the club was his only way of ensuring regular action ahead of the World Cup next year.
Gomez has 25 goals in 58 appearances for Germany.
He joins a side that impressed last season under first-year coach Vincenzo Montella, finishing fourth in Serie A.
The Viola were praised for their fluid, Spanish style passing game but they lacked a strong finisher – a position Gomez will be expected to occupy.
Fiorentina is also hoping that Giuseppe Rossi can contribute in attack, having only played the final match of last season after a long injury layoff.
Fiorentina's prized playmaker Stevan Jovetić is expected to transfer. – Sapa-AP