1. In terms of death and destruction, the Hiroshima nuclear attack wasn't the biggest attack on a Japanese city. The conventional fire bombing of Tokyo killed far more.
2. The Russians were poised to mount a massive invasion.
The Imperial Family agreed to surrender because they were advised that while the Japanese military might be able to hold off an American invasion, it could not withstand a combined US and Russian attack.
By the way, what was Japan fighting for?
To line the pockets of the Imperial Family, the richest family in Japan. That's it.
They planned the war, they ordered the war, they profited from it and they were willing to sacrifice the civilian population to carry out their goals.
For example, billions of dollars worth of stolen gold and valuable art (much of it scouted out years in advance) was shipped directly to the Imperial compound in Tokyo. None of it has been returned.
As a condition for surrender, the Imperial Family was allowed to remain in power unpunished and they remain in power today.
Can you imagine what would have happened to those murderous, thieving bastards if the Russians had gotten to them first?
But as always, the US government was ready to make a "deal" - in this case to have a base to fight Communism.
After the war, the US government also protected - and hired - veterans of Japan's Unit 731.
You've heard of Nazi medical atrocities, but the Japanese program was exponentially larger and its crimes were largely covered up with the help of the US government which wanted access to the data and the practitioners.