One only needs to research the Japanese policy of “ketsu go” and you’ll know why the bombs were dropped.
The Japanese were gonna fight to the bitter end. Even in the end, when the Emperor was going to a radio station to broadcast the surrender, jr officers tried to stage a coup to stop him.
Hiroshima was bombed because it contained the HQ of the Japanese 2nd General Army (ground zero was their parade grounds). In the event of an allied invasion of southern Japan, 2nd General Army HQ would coordinate all Imperial army operations in that region.
Also, the city was a communications center, a storage point, and an assembly area for troops. It was one of several Japanese cities left deliberately untouched by American bombing, allowing a pristine environment to measure the damage caused by the atomic bomb.