So prior to the nukes Japan had just lost their entire navy, their air force, and practically all their conquests in Asia where they killed well over 20 million civilians and lost 2 million soldiers in the process.
After Hiroshima the US gave them three days to surrender.
They didn't. One of most inevitable defeats in modern history and not only did they not surrender after the first, they tried to call America's bluff, and there was a coup attempt to prevent surrender after the second.
If you'd like some reading on the Japanese militarist cult and propaganda campaigns that enabled a people to be so delusional there's quite a lot of scholarly work available.
In any event the cause of their delusional dreams was the same cause that led them to having baby-bayonetting contests in China: ethnic supremacist rhetoric functionally identitical to Nazism that told them Americans and Soviets would be doing to them what they'd just done to China, Korea, the Phillipines, and many other nations.