Hiroshima was the 2nd Army HQ, the command and communications center for southern Japan, a storage depot and assembly point for troops. Nagasaki was a large seaport, an important producer of ships, ordnance, and military equipment. Mitsubishi had a plant in Nagasaki that made aircraft motors. Nagasaki also hosted a torpedo factory and was a site for Kamikazes trained in operating explosive-laden boats designed to ram enemy landing craft.
Hiroshima and Nagasaki were chosen for their military capabilities and because their terrain maximized the effect of detonating the bombs; they were not chosen for the purpose of incinerating civilians and/or wiping out entire cities.
Hiroshima and Nagasaki were good military targets.