Kompany and Nasri spent six years together at Manchester City winning two Premier League titles and one League cup.
Nasri, 32, was a free agent after leaving West Ham United at the end of the 2018/2019 season, where he made just six appearances following a move to the London club in the winter transfer window.
Before joining West Ham United in January, Nasri served an 18-month doping ban for ‘unknowingly’ taking an intravenous drip treatment at a Los Angeles clinic in 2016.
'I received a number of great offers, but in the end I chose RSC Anderlecht with a great deal of conviction,' Nasri said on the club's official website.
'I absolutely want to help Vincent and the club to succeed in their set-up.
'Vincent Kompany was my team-mate at City between 2011 and 2017. I know him through and through and know which project he has in mind with Anderlecht.
'Together with him and the entire team I want to do everything to make this a success.'
Capped 41 times by the France national team, Nasri has also played for the likes of Olympic Marseille, Arsenal, Sevilla and Turkish club Antalyaspor.
Kompany joined his boyhood club at the end of last season after winning his fourth Premier League title with Manchester City.
Kompany led Manchester City to their most successful era, winning four Premier League titles, two FA Cups and four League cups, and the former Belgium captain will be hoping his time in the dugout will be just as fruitful.