The 33-year-old has signed a three-year deal with the Belgian club after 11 years at Etihad Stadium, eight of which he spent as club captain.
Saturday’s 6-0 FA Cup final win over Watford was Kompany’s final game for City, after winning four Premier League titles, two FA Cups and four League Cups.
In an open letter on Facebook, Belgium defender Kompany said leaving City “doesn’t feel real”.
“Countless of times have I imagined this day,” he said. “After all, the end has felt nearby for so many years.
“Man City has given me everything. I’ve tried to give back as much as I possibly could.”
In a second letter released hours later, Kompany announced his move to Anderlecht, who said his arrival marked the “return of the prince”.
“I want to share my knowledge with the next purple generations,” said Kompany, who first joined Anderlecht at the age of six.
“With that, I will also put a bit of Manchester in the heart of Belgium.”
‘The time has come to go’
Centre-back Kompany joined City from Hamburg as a defensive midfielder in 2008 and was named club captain three years later.
He scored his final goal against Leicester on 6 May, a brilliant strike from 25 yards that was voted goal of the season on BBC Match of the Day.
That victory took City to within one win of the Premier League title, which they sealed on the final day of the season with victory at Brighton.
“The time has come for me to go now,” Kompany said.
“As overwhelming as it is, I feel nothing but gratefulness. I am grateful to all those who supported me on a special journey, at a very special club.
“I remember the first day, as clear as I see the last. I remember the boundless kindness I received from the people of Manchester.
“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.”
“He defines the essence of the club. For a decade he has been the lifeblood, the soul, and beating heart of a supremely talented squad.
“A booming voice in the dressing room yet a quiet and measured ambassador off it, Vincent can be as proud of himself as we are of him.”
‘A special character’ – chairman pays tribute
After the 1-0 win over Leicester – City’s final home game of the season – Kompany was in tears as the team enjoyed a lap of honour.
By beating Watford 6-0 at Wembley, City became the first men’s side to complete the domestic treble in England.
In September, the club will hold Kompany’s testimonial match, from which he will donate all profits to Manchester’s homeless.
He said: “Sheikh Mansour changed my life and that of all the City fans around the world, for that I am forever grateful. A blue nation has arisen and challenged the established order of things, I find that awesome.
“I cherish the counsel and leadership of a good human being, Khaldoon Al Mubarak. Man City could not be in better hands.”
Al Mubarak said: “He will always be part of the City family.
“I am not sure he expected to lift the Premier League trophy on four occasions during his captaincy but he will be remembered and revered whenever this period of unprecedented City success is spoken about by future generations.
“His leadership, intelligence and determination have seen him adapt brilliantly to playing under four different managers and overcome some debilitating injuries.
“He is a special character who has answered every demand the club has made of him.”
‘I stopped at Anderlecht just to say hello’
Kompany scored five goals in 73 games for Anderlecht from 2003 to 2006.
The club are the most successful team in Belgian history but are currently sixth in the Belgian First Division A. They have won 34 league titles, the most recent in 2016-17.
“I stopped at their training grounds on my way to international duty last year. Just to say hello,” Kompany said.
“[Marc] Coucke, the chairman, and sports director Michael Verschueren asked my opinion regarding the difficult situation the club was in.
“I shared my thoughts and listened to their vision for the future: ambitious, courageous and determined to get back to number one.”
Kompany offered his help with “no strings attached”, and said it was “unexpected” when they offered him the position of player-manager “not so long ago”.
“I was left not only impressed, but also intrigued by this sign of confidence in me,” he said.
Kompany bids farewell in ‘great fashion’
Injuries have taken their toll on Kompany in recent years, and he featured in only 17 of City’s 38 league games this season because of muscle injuries.
However, he will be remembered for his influence and contribution on the pitch, where he led City to a first top-flight title since 1968 in 2012.
Along with Sergio Aguero and David Silva, Kompany is one of only three survivors from that triumph, and they repeated the achievement in 2014 and 2018.
City retained their title this month, finishing one point ahead of Liverpool after one of the most thrilling seasons in Premier League history.
“How often does someone get the chance to end such an important chapter, representing a club with such great history and tradition, in such a great fashion?” Kompany said.
‘We will miss you captain’ – reaction
Manchester City midfielder Kevin de Bruyne:Playing for about 10 years with this man for club and country. And what a privilege it’s been. Big player, big personality and big leader. Learned a lot from you. Wishing you all the best for the future.
City midfielder Phil Foden: Looked after me from day one. Led by example, showed everyone what it means to be a leader, wear their heart on the sleeve, and give everything for this club. We will miss you captain
Former City striker Paul Dickov: City loves you more than you will know
Ex-England and Manchester United defender Gary Neville: I didn’t expect that. There are some players you wish played for your club. Vincent Kompany was one of them. A great centre back whose influence on and off the pitch was huge.
Former England and Newcastle captain Alan Shearer: What a captain and player.
Ex-England and Liverpool defender Jamie Carragher: One of the best centre-backs the Premier League has ever seen & one of Man City’s greatest ever players!