The 61-year-old Italian, who managed Real Madrid for two years between 2013 and 2015, has left Everton after 18 months in charge at Goodison Park.
He succeeds Zinedine Zidane at Real and the move leaves Everton searching for a sixth permanent manager in five years.
Ancelotti has signed a three-year deal at Real and said the move represented “an unexpected opportunity”.
He added: “I have complete respect for everyone associated with Everton and hope they can achieve the exciting opportunities they have in front of them.
“While I have enjoyed being at Everton I have been presented with an unexpected opportunity which I believe is the right move for me and my family at this time.”
Real will present Ancelotti to the media on Wednesday, while Everton said they “will begin the process of appointing a new manager immediately”.
Everton will have been left stunned by the speed of developments in the last 24 hours as owner Farhad Moshiri’s “Hollywood” manager leaves.
Ancelotti’s arrival was regarded as a real coup by Moshiri, persuading one of the game’s most decorated and respected figures to come to Merseyside to restore Everton to former glories.
The 61-year-old’s reign has been a mixed bag with dreadful home form balanced out by results like their first win over Liverpool at Anfield since 1999 – but ultimately a 10th-place finish in his first full season was a disappointment.
Ancelotti, however, was still held in huge regard by Everton supporters, who have been left bitterly disappointed by his decision to depart.