Why can fish survive out of water?
Do not have too a "panselectionist" view of evolution!

You can survive in a bath of mercury for a little while. You can survive naked in the outer space for a while (see here). Yet none of your ancestors where exposed to such conditions. We can be tolerant to certain conditions without having been selected to tolerate it.

Similarly, you managed to survive in your very specific environment. Yet none of your ancestors ever encountered this specific environment.

In other words, evolution is more than just natural selection. Not every phenotype in every environment you can think of is the result of a direct selective pressure acting on it. A classical and easy to read paper on the subject is Gould and Lewontin (1979).

Why fish not die suddenly outside of the water?

The main reason why fish die outside of water is that they cannot intake oxygen from air (see Breathing under water; not considering lungfish). So once fish are exposed to air only, they stop intaking oxygen, consume the oxygen that they have left in their circulatory system and tissues and slowly die of asphyxie but there is no reason for the death to be direct and sudden.