Sarri became the front-runner for the Stamford Bridge job after former Barcelona boss Luis Enrique's wage demands priced him out of the equation.
Ancelotti has signed a two-year deal at Napoli.
I thank Maurizio Sarri for his dedication to Napoli which has brought great prestige and emotion to the city by creating a style of football which is admired everywhere and by everyone.
Napoli president Aurelio De Laurentis thanked Sarri for his time at the club.
Carlo Ancelotti is still a revered figure with Chelsea supporters and his popularity could soar in the coming weeks.
Expectations may be downplayed, but if they can maintain their star players and make astute signings, Ancelotti may savour more success yet.
After the 59-year-old Sarri was confirmed to have departed Napoli on Wednesday evening, De Laurentiis took to Twitter to show his appreciation for Sarri's service at the Stadio San Paolo over the last three years.
Italian film producer De Laurentiis then announced Ancelotti's arrival with a staged photo of the pair standing back to back holding imaginary guns ready for a shootoff.
Sarri also has an offer from Russian giants Zenit St Petersburg but is believed to be stalling on their offer as he waits for a concrete one from Chelsea, who he is keen to manage.
Sarri is reportedly unimpressed with an offer he has received from Zenit, while Chelsea are allegedly mulling over their options because Antonio Conte will not resign and his FA Cup victory has owner Roman Abramovich reconsidering firing him.