Benzema is Real Madrid's second-highest goal scorer of all time and has won a joint-record 25 trophies with the club -- including five Champions Leagues and four LaLiga titles -- as well as the 2022 Ballon d'Or.
"Real Madrid C.F. and our captain Karim Benzema have agreed to put an end to his brilliant and unforgettable time as a player for our club," Madrid said in a statement. "Real Madrid wants to show its gratitude and all its affection for a player who is already one of our greatest legends.
"Karim Benzema's career at Real Madrid has been an example of behaviour and professionalism, and he has represented the values of our club. Karim Benzema has earned the right to decide his future ... Real Madrid is and will always be his home, and we wish him and his entire family all the best in this new phase of his life."
The club said an event would be held at its training ground on Tuesday to pay tribute to Benzema.
ESPN reported earlier in the week that Benzema had been offered a two-year contract worth €400 million to move to Saudi Arabia in January, the same deal as Cristiano Ronaldo, who joined Al Nassr after leaving Manchester United.
The centre-forward had been expected to stay at Madrid for one more season until June 2024 but is opting instead to accept a new challenge.
He took on the mantle of Madrid's lead goal scorer when Ronaldo left in 2018 and had a career-best season last year, scoring 27 times in LaLiga and 15 times in the Champions League as the club won both trophies. That form was recognised when Benzema was awarded the Ballon d'Or in October.
The Madrid captain has struggled with injuries this season, missing the World Cup, but still scored 18 goals in 23 LaLiga games.
His 25 trophies at the club -- a record shared with Marcelo -- consist of four LaLiga titles, five Champions Leagues, three Copas del Rey, four Spanish Supercopas, four UEFA Super Cups and five FIFA Club World Cups.