The Hammers took the lead midway through the first half in Nanjing. Mark Noble converted a penalty won by Felipe Anderson for a handball by Angelino.
But Man City, whose starting line-up had a youthful look, responded with two goals in the space of four minutes and took a lead into the break.
Eighteen-year-old Adrian Bernabe assisted David Silva to score from a tight angle, before Lukas Nmecha scored a penalty after the referee adjudged he had been tripped by Angelo Ogbonna.
Raheem Sterling was then introduced at half-time by Pep Guardiola and the England winger took the match away from West Ham.
He finished coolly after being played clean through by Leroy Sane and then forced the ball past goalkeeper Roberto when fellow substitute Kevin De Bruyne unselfishly squared into his path.
The loss for West Ham means they will take on Newcastle United in Saturday's third/fourth place playoff which precedes the final at Hongkou Football Stadium.
Wednesday 17 July, Nanjing Olympic Sports Center
Newcastle 0-4 Wolves
Man City 4-1 West Ham
Saturday 20 July, Hongkou Football Stadium, Shanghai
Newcastle v West Ham, third/fourth place playoff, kick-off 17:00 (10:00 BST)
Wolves v Man City, final, kick-off 19:30 (12:30 BST)