The password that the iMac is looking for is not the Apple password, by which I presume you mean your Apple ID password,
It is looking for the account password of the person who is logged into the iMac. It is specific to that account. Presumably the iMac is presenting you with a small window showing the username and password lines, possibly with the username already filled in.
Although your iMac does not ask for a password when it is turned on, automatic logon is enabled, there is still a password associated with that account.
Yes, you can nuke the whole thing and reinstall the operating system but to do that you will need a copy of the OS X installation disk. Right now I'm betting you don't have that.
With that disk you could either reinstall the OS or you could reset the account password.
To find out what version of OS X your iMac is using, go to the top left hand corner of the screen, when the little Apple symbol is, and click it. That should bring up a list of things, including "About this Mac" or "About this Computer". Click that and another window will appear which contains that information. It will be something like 10.x.x, where x is a number between 0 and 10.
As for your second option, yes, you could "nuke the whole thing" (this is for the second nuke) and install XP on it BUT, to do that you will need a copy of the OS X installation disk, the account password, a copy of Windows XP and, most importantly, an iMac with an Intel processor. (The "About this Mac" page will give you the information about the OS and the processor.)
Get back to us with the above information and we can go from there
P
I have a iMac running some sort of operating system, no idea how to find out. This thing lives in a back room and is only used by my grandchildren to watch YouTube videos, now Safari tells me Flash need updating so I downloaded the update, managed to find the file and tried to install it but the IMac won't allow me to install it without entering a password. What password??? So after much fooling around I manage to reset my Apple password but it won't accept the new password. Okay then, because this thing doesn't work well anyway, lots of things that don't work on it, can I nuke the whole thing and reinstall the operation system? If so how?
Second option, can I nuke the whole thing and install Windows XP as the one and only operating system?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic