Milan said the 25-year-old Frenchman signed a five-year contract through 2026. He will move to Serie A after representing France at the European Championship.
Milan will play in Champions League next season after clinching second place in Serie A on Sunday. The seven-time European champions are returning to the competition after an eight-year absence and could land in the same group as Lille.
Milan will be among the lowest-ranked teams in the draw, which will be made on Aug. 26. Lille will be a top-seeded team as the champion of France.
Donnarumma, 22, broke into the Milan first team before his 17th birthday in 2015 and quickly cemented his spot. He has made 251 appearances for the club in all competitions, keeping 88 clean sheets, and played a key role in helping the club finish second in Serie A this season.
AC Milan technical director Paolo Maldini insisted that there are no hard feelings with Donnarumma.
"I think we must thank all the players who made this an incredible season. Gigio was a leader and often our captain," Maldini said on Wednesday.
"People struggle to understand what it means to be a professional, and that you have to be ready to change club."