iMac shut down due to power outage; started working after a few hours
Solution 1:
When the power goes off, then everything stops immediately.
The problem with happening is a 'normal' shutdown takes time. Applications and the OS need to save files, and 'put things away' cleanly. If you have a mechanical hard drive, then suddenly stopping it means it won't have time to park the drive head (like putting the needle of a record player on its rest).
It's possible that a power shut-off can 'stress' various components.
There's no reason I can think of why the iMac shouldn't restart normally as soon as power is restored. You're sure power was restored, and all fuses or circuit-breakers were back in the "ON" position?
The occasional power cut shouldn't do any damage; but each one might increase some component failure. Also, having an unreliable supply may affect the lifespan of the internals.
Solution 2:
Once power came it is not starting but when I tried after few hours it started.
Switching power supplies have a re-settable fuse that will trip if there is a power surge and reset itself after some time or if you remove the power cord and hold the power button to dissipate any remaining charge in the circuits. So, the symptoms you describe are very much in line with how these circuits work. They cut off current for a period of time and then reset themselves so your power supply works again.
When you have a power outage, it is very common for the power to come back with a power surge (also known as a voltage spike). This fuse is built into the power supply to protect it from surges like this.
That said, I wouldn't depend on it as it's not designed to absorb higher spikes like those that come from lightning strikes - get a quality power surge protector (not a power strip, but an actual surge protector (they are significantly more expensive than a power strip).
Resetting the NVRAM or SMC will not have any effect. The NVRAM only holds pre-boot environment variables and the SMC doesn't control this fuse. For the SMC to function, you need to have power (3 VDC), if the power was cut off (like the fuse did), the SMC is in an off state and won't respond to anything.