Rooney said: "It is some time since I said that the only Premier League club I would play for other than Manchester United was Everton, so I am delighted that the move has happened.
"Thirteen years ago I went to United with the intention of winning trophies and I have been fortunate to be a part of one of the most successful periods in the club's history.
I have come back to Everton because I believe Ronald Koeman is building a team that can win something and I look forward to playing my part in making that a reality for the club I have supported since a boy."
Everton manager Ronald Koeman said: "Wayne has shown me that ambition that we need and that winning mentality - he knows how to win titles and I'm really happy he's decided to come home.
"He loves Everton and he was desperate to come back. He is still only 31 and I don't have any doubts about his qualities. It's fantastic he's here."
United manager Jose Mourinho said: "It is no secret that I have long been an admirer of Wayne. He has been a model professional throughout his time at the club and will remain in the history books for many years to come.
"It is never easy to see a great player playing less football than he would like and I could not stand in his way when he asked to go back to Everton. His experience, focus and determination will be missed and I wish him well for the future."
Rooney switches back to Merseyside as part of a deal that will see United sign striker Romelu Lukaku for up to £90m.
After an illustrious time under Sir Alex Ferguson in which he won five Premier League titles and the Champions League, he struggled to nail down a place in Jose Mourinho's first-team last season after a difficult previous campaign under Louis van Gaal.
He picked up a Europa League winners medal last season and also won the FA Cup under Van Gaal, and leaves Old Trafford having scored 251 goals in over 500 games.