Using Fukushima as an example. Immediately upon earthquake detection, all the control rods dropped into place and shutdown the nuclear reaction and power generation.
Despite shutdown, the core remains hot, much like a car engine that has just had its ignition key removed a minute ago. Unlike a car engine though, the Fukushima reactor is unable to dissipate the heat naturally, and so requires cooling pumps.
But with the reactors shutdown, how do you power the cooling pumps? You use either or both, grid power or onsite diesel generators. In the case of Fukushima, the tsunami wave that arrived an hour after the earthquake, flooded and destroyed the switch gear for both.
Evidently an hour of cooling is not enough. The shutdown reactors remained hot enough to split water into hydrogen & oxygen. The hydrogen production could not be contained, the hydrogen ignited, and blew the tops off the buildings (though the reactor pressure vessels & concrete radiation containment remained intact).
In summary, external power for cooling systems is mandatory for a nuclear power station (either grid power or diesel generators). You can't rely on a shutdown core to generate enough power for the cooling pump.
Incidentally, there are newer Generation IV (four) reactor designs which use passive cooling techniques. These new reactor designs could potentially do away with external power. The Fukushima reactors are Generation II (two) design.