Komany, 33, joined City in the summer of 2008 and turned out 360 times, winning four Premier League titles, two FA Cups, four League Cups and two Community Shields.
His last appearance came in Saturday's FA Cup final demolition of Watford. The 6-0 battering sealed an historic domestic treble for Pep Guardiola's men of League Cup, Premier League and FA Cup.
"As overwhelming as it is, the time has come for me to go," said Kompany. "And what a season to bow out. I feel nothing but gratefulness. I am grateful to all those who supported me on a special journey, at a very special club."
Kompany, who went to City from the German club Hamburg, added: "I will never forget how all Man City supporters remained loyal to me in good times and especially bad times.
"Against the odds you have always backed me and inspired me to never give up.
A blue nation has arisen and challenged the established order of things, I find that awesome."
Kompany's last goal for City – a thunderbolt strike from 25 metres – secured a 1-0 victory over Leicester City in the penultimate Premier League game of the season. The success sent his side back to the top of the table and they clinched the title – one point ahead of Liverpool – with a 4-1 destruction of Brighton.
"It's cliche to say it but it's also so true: without my team-mates, I would have never been here today," Kompany added.
"We fought many battles together. Side by side. In good times and in bad. So to all of you, from the 2008-2009 squad to today's domestic treble winners: I owe you guys!
"A special word also to Pep and the backroom staff: you've been superb. You've followed me through so much hardship. You made me come back stronger every time. Thank you so much."