The reality is far more horrific. The Japanese were preparing to surrender to the Soviets, but the US couldn't have the Soviets take credit for winning the war on both fronts so they dropped a couple of nukes on Japan.
The reality is that it was a complicated decision and there were many factors that went into it and many subsequent interpretations of the history on all sides.
This Twitter thread provides an interesting overview of some of the historiography: https://twitter.com/wc_quinn/status/1458891500344029189