Andersen will move to Selhurst Park for a fee of €22m.
The 25-year-old Denmark international spent last season on loan at Fulham, making 31 Premier League appearances, but could not prevent their relegation to the Championship.
He joins Michael Olise, goalkeeper Remi Mathews and Marc Guehi as Palace’s new signings in the summer transfer window.
"I'm extremely proud to be joining Crystal Palace and to be playing in the world's best football league," Andersen told the club website.
"The management of the club and Patrick Vieira have given me very strong assurance that they know my qualities, they believe in me and want me to play an important role in the team.
"I have a very positive impression of Patrick from the conversations I have had with him, and I have heard nothing but great things about the manager, the club and its plans for the future."
Eagles chairman Steve Parish added: 'In Joachim, we have added another highly-rated defender to our squad, and as a player with Premier League and international experience, we are extremely pleased to welcome him to Crystal Palace.'
Andersen made three appearances as Denmark reached the semi-finals of EURO 2020.
Palace begin their 2021/2022 Premier League campaign away at Chelsea on August 14.