You can drop a nuke to end the war and save american lives/prevent long drawn out war while also doing it to flex your new muscle towards other countries. Japan can also have been on the brink of collapse and ready to give in. Or they could have been ninjas.
End of ww2 was a big inflection point where a lot happened and could be argued about endlessly. There are a lot of perspectives and reasons that are valid, world wars being what they are in nature. Decisions will have multiple reasons for being made and will impact multiple other things.
*uhhh....in the context of decision making and how the world was going to emerge out ww2, that is. Not backing nazis and such.