There were numerous reasons as to why the bomb was dropped. Ranging from political reasons with the American people, to diplomatic reasons with the Soviet Union. Im going to touch up on one though, the primary reasons.
Truman shared the same goal as FDR before his death--which was to end the war as soon as possible with the least amount of American casualties. The US had already suffered unimaginable losses in Iwo Jima, Tarawa, Okinawa. The only other alternative to an unconditional surrender by Japan was either: A full invasion(which was in the works) and/or a blockade.
A) Both of those options meant that victory could be months away. Some estimates showed that a blockade would result in the starvation and deaths of millions of Japanese, and still result in inevitable American casualties.
B) An invasion of Japan was almost unthinkable. Hirohito on June 8th 1945 agreed to all-out resistance of the Japanese Civilian population, in which nearly 100 million civilians were being actively trained in preparation for an American Invasion of Japan for a heroic last stand.
Conservative estimates would have put the casualties for an Invasion of Japan, at roughly 1 million for the United States alone. Japan would have lost roughly 1/3rd of it's entire population. We're talking tens of millions of people. Read it again. Tens of millions of people.
Roughly 500,000 purple hearts were manufactured in preparation for this invasion, and to this day that stockpile hasn't been depleted--even though they've been handed out to injured American military personnel in every war since WWII and we still haven't depleted the supply. I'm talking the Korean War, Vietnam, the Gulf War, and Iraq occupation combined.
However, an invasion never took place. 1/3rd of the Japanese population didn't have to die in an invasion. The US didn't have to suffer an additional 1+ million casualties. Why is this?
The atomic bomb.
The bomb, as cruel and horrible as it was--ended the war. It prevented the Japanese leadership from furthering an already pointless war and lost cause, it prevented them from continuing the suffering of their own people, after selfishly refusing to surrender numerous times.
The dropping of the atomic bomb was a merciful decision on our part. It spared Japan complete Annihilation that an invasion would have brought, and saved tens of millions of lives.