The heating of the can causes the temperature of the water inside to become 100°C. Therefore its pressure is approximately equal to that of the atmosphere(ebullition). When it is in ebullition it changes from liquid to gaseous state, and the volume of the can completely filled by water in liquid state is in equilibrium with its vapour.
When the can is turned 180°, the water vapour is kept inside it and the liquid flows to the hole.
When the inverted can is dived into the water which is at a smaller temperature of about 25ºC, it will cause an abrupt change in the temperature. The vapour inside the can will be suddenly cooled and condenses immediately.
It is known that a certain number of molecules, in the gaseous state, occupy higher volume than the same number of molecules in the liquid state (1 mole of gas occupies 24dm³). That is explained by the fact that the space between molecules is larger when it is in the gas state. Most of the space in the can was filled by water vapour. Thus, the condensation of it will cause an abrupt decrease of pressure.
The can will shrink until a new equilibrium state is reached. It means that when the vapour condenses, the can will have a certain free space that has to be filled out. As the can doesn't offer great mechanical resistance (it is made of aluminium), it implodes until it finally finishes compensating the abrupt decrease of pressure. The can doesn't implode more because the cold water also enters inside through the hole.