Answer
The pressure in the can falls to less than atmospheric pressure, and the force imbalance collapses the can.
Work Step by Step
Steam pushes some air out of the can. Before the lid is placed on, the pressure inside the can matches atmospheric pressure.
When the lid is put on, and the can and its contents are allowed to cool, the trapped steam condenses into liquid, leaving a void.