WW2 was an existential war. The Allied powers had agreed that the only acceptable end to the war was unconditional surrender by the Axis. Combatants mobilized their entire societies to fight -- the US was spending about 40% of GDP on the military in 1945. The nuclear bomb had never been used before, so the nuclear taboo did not exist. Allied air forces had been pounding Axis population centers with conventional bombs for years, killing millions. The American invasion of Okinawa caused the deaths of approx 100,000 Japanese troops, 20,000 Americans, and 150,000 Okinawan civilians. American military planners thought that an invasion of the Japanese home islands would have similar casualty exchange ratios as Okinawa, which would leave hundreds of thousands of American troops dead, millions of Japanese troops dead, and millions of Japanese civilians dead.
There were scant alternatives to the bomb. The war had to end fast, the American people demanded nothing less. Wearing down the Japanese with continued strategic bombing, a naval blockade, and the Soviet invasion of Japanese held areas on the mainland would be slow, uncertain, and cause many more deaths than the atomic bombs did. The Japanese willingness to surrender is hotly debated, so all I'll say is this: the Americans had observed constant Japanese fanaticism over the course of the war. Japanese soldiers would pretend to surrender while they clutched grenades to their chests, the surrender of Japanese units larger than platoons was nearly unheard of, and the Japanese population was basically brainwashed. A common saying on the island was "victory, or a hundred million dead souls".
So given all that context -- existential war, lack of a nuclear taboo, normalization of strategic bombing, lack of belief in the Japanese will to surrender, and political pressure to end the war quickly -- dropping the bomb was inevitable. It was horrible, unfathomably cruel, and ended the innocent lives of blameless men, women, and children. It wasn't nice, fair, or honorable. But there was no better option, so we did it.