Ancelotti, who won the Serie A title once as Milan coach, is hopeful that his "knowledge and experience" can help Napoli topple seven-time defending champions Juve.
"I'm very happy to return to my country and to one of the greatest teams in Italy," he said in a statement on his official website.
"We come to compete and give Napoli all our knowledge and experience. We are thrilled by this challenge and to open a new stage in football.
"I want to thank the president for trusting me in a project that I love and for the chance to get to know one of the best clubs in Italy. To the fans, I say that we will work hard and very professionally to reach our goals that we all want.
"I hope we can all enjoy this together."
Ancelotti had been linked with a return to Milan and the Italy national team job before arriving at Napoli in place of Sarri, who is reportedly be set for a move to Chelsea.