Having returned to England from a loan at Torino last season, Hart underwent a medical with the Hammers on Monday and it is thought that his parent club will part fund his 2017/18 wages.
A bizarre line-up video shared by West Ham on Twitter marked confirmation of the deal on Tuesday evening as Hart was 'welcomed to the family'.
"It's important for me to play football and to get the opportunity to come here and play is absolutely awesome. To be playing in the Premier League for a big club like West Ham, I'm really looking forward to the season," the 30-year-old told WHUFC.com.
"I've always loved the club. I think you'll struggle to find anyone, apart from the direct opposing fans around London, who doesn't love the club. It's got something about it, it's got a lot history and I've always loved playing against West Ham," he added.
After six seasons as City's undisputed number one, the 30-year-old was deemed surplus to requirements in Manchester by new coach Pep Guardiola last summer.
Claudio Bravo was brought in from Barcelona to replace him, with City adding £34m Ederson Moraes to their ranks as well. Pepe Reina has also been been the subject of a City bid.
Hart becomes the second West Ham signing of the summer, and the second to arrive from the blue half of Manchester after long serving City favourite Pablo Zabaleta joined as a free agent.
Hart's arrival in east London could prompt the Hammers departure of Darren Randolph, with the Republic of Ireland stopper linked with a move to Newcastle. Former number one Adrian was expected to be released this summer until he signed a contract extension in May.