The 32-year-old David De Gea was a free agent after his contract at the Old Trafford club ran out at the end of June.
De Gea has been at United for 12 years and his 545 appearances and 190 clean sheets are club records for a keeper.
"I just wanted to send this farewell message to all Manchester United supporters," he wrote on social media.
De Gea started his career at Atletico Madrid but joined United for £18.9m in 2011.
The announcement of his departure comes with United manager Erik ten Hag's side hopeful of concluding a deal for Inter Milan goalkeeper Andre Onana.
David De Gea added: "I would like to express my unwavering gratitude and appreciation for the love from the last 12 years. We've achieved a lot since my dear Sir Alex Ferguson brought me to this club.
"I took incredible pride every time I pulled on this shirt, to lead the team, to represent this institution, the biggest club in the world was an honour only bestows upon a few lucky footballers.
"It's been an unforgettable and successful period since I came here. I didn't think from leaving Madrid as a young boy we would achieve what we did together.
"Now, it's the right time to undertake a new challenge, to push myself again in new surroundings.
"Manchester will always be in my heart, Manchester has shaped me and will never leave me."
It is understood the framework of a contract extension that had initially been agreed between United and De Gea was subsequently changed.
That led to both sides stepping back to reflect on the situation, and now this outcome.
David De Gea, who has been linked with a move to the Saudi Pro League, won the Premier League, FA Cup, Uefa Europa League and two Carabao Cups while at United.
He is a four-time United player of the year winner and claimed the Premier League Golden Glove for a second time last season as he kept 17 clean sheets.
"To have won player of the year awards from both the fans and his team-mates, each on four occasions, shows the level of his performance and he will always be remembered as one of the very best goalkeepers in the history of the club," said Ten Hag.