Wagner, whose final stint as a player was in the Chinese Super League with Tianjin TEDA, says he turned down a number of offers from German clubs and will instead embark on a career as a coach.
After leaving Bavaria in 2019, he has spent the last year-and-a-half in China with Tianjin TEDA but recently cancelled his contract there.
Speaking to BILD, he has now revealed that he has decided to retire from the game.
Wagner, who also appeared for Werder Bremen, Hertha BSC and Hoffenheim among others, revealed that he plans to move into coaching.
He will start a DFB course in September and aims to move into that sector next summer after taking a year off to enjoy time with his family.
After rejoining Bayern in 2018, he became a popular figure in his solitary season there in his second spell, scoring 10 goals in all competitions before moving to China.
He is the third ex-Germany international to announce a surprise early retirement in recent weeks, after 2014 World Cup winners Andre Schürrle and Benedikt Höwedes.