The 21-year-old becomes the fifth summer arrival at Palace after spending the 2020/21 season on loan at West Bromwich Albion, where he scored twice and provided two assists in 30 Premier League appearances.
"I can’t wait to get started, I’m happy to get the deal over the line," Gallagher told the club's official website.
"I spoke to the manager, I liked what he said, I liked how he wants to play, how he wants me to play and how he wants the team to play. I feel like I can learn from him and the players around me."
Gallagher spent loan spells at Championship clubs Charlton Athletic and Swansea City in 2019/20, scoring six goals and supplying 11 assists in 47 matches.
The midfielder has played nine times for England Under-21s and was part of the squad that won the Under-17 FIFA World Cup.
Gallagher will hope to make his Premier League debut for Palace at home to Brentford on 21 August, with the on-loan midfielder ineligible to face parent club Chelsea on the opening weekend.