Answer:
President Harry Truman wanted to put an end to the war. Germany had already surrendered, and the only open front was the Pacific Theater, where American troops were fighting hand-to-hand in Japanese territory against Japanese forces.
The truth is that during these battles, especially during the Battle of Okinawa, Japanese forces showed courage and total dedication to the cause, which led them to fight to the death, literally. There was no surrender, and the few Japanese who survived did so with really disabling wounds. Every Japanese fighter who could continue fighting did so, giving up his life for his nation and, obviously, requiring more effort and a greater cost of American lives.
This situation led the American military commanders to realize that an invasion of Japanese territory was unfeasible, since it would be a massacre, with an incalculable cost of American lives.
To avoid unnecessary lengthening of the war, and a number of pointless American deaths, President Truman made the decision to carry out an attack with a force so great that it would deter Japan from wanting to continue the war. Thus, the United States dropped the atomic bombs in Hiroshima and Nagasaki, which showed Japan the war power of the United States, forcing its surrender.