The game will be played at the London Stadium during the week commencing 25 October.
The date and time will be confirmed in due course along with ticket details.
City are looking to win the competition for a fifth successive year and a record ninth time overall.
CITY+ | SIGN UP TO ACCESS EXCLUSIVE CONTENT
Former City defender Micah Richards and ex-Spurs boss Harry Redknapp pulled the numbers out of the bag.
City and West Ham last met during the 2013/14 season at the semi-final stage.
The Blues won 6-0 in the first leg at the Etihad and 3-0 at Upton Park to win 9-0 on aggregate.
In 1984, the Hammers held City 0-0 at Maine Road in the League Cup, but City won the replay 2-1 in Easy London.
Those were the only occasions the two clubs have met in this competition.
Full draw:
Chelsea v Southampton
Arsenal v Leeds United
Stoke City v Brentford
West Ham United v Manchester City
Leicester v Brighton
Burnley v Spurs
QPR v Sunderland
Preston NE v Liverpool