The short answer is that it was not against the laws of war. It not being unlawful, it was not a crime.
Those laws have since been changed so that if it were to happen today, then yes, it would be a war crime. (Obviously when it comes to today's strategic nuclear exchanges, war crimes tribunals after the fact are not really a major concern in the larger scheme of things).
There are a couple of points to bear in mind. Firstly, the lack of any prohibition on the matter of aerial bombing. Some rules had been proposed in the run up years to the war, but were never enacted. As a result, the same general legal principles as applied to ground and naval warfare were the ones which applied. Although the laws prohibited engaging defenseless targets, this was interpreted rather loosely, the anti air guns, overhead fighter cover were considered enough to count. Note that nobody from any side was convicted of war crimes for strategic bombing of cities.
The second point is that the two A-bombs were not the most deadly raids of the war. Compare the Tokyo fire bombing. If that wasn't a war crime, why would using the A-bombs be? Fat Man was basically just a bomb. A really, really devastating bomb, able to do in one drop what a fleet of B-29s would take to do with other munitions, but the end result was the same: Devastated city. Just the a bomb was more efficient.
After the war, the effects of aerial bombardment on civilian population centers in general (So Dresden, Tokyo, London etc all were motivators, not just Hiroshima and Nagasaki) led to the conclusion that such techniques were morally repugnant and should be banned. Hence in 1949, the Geneva Conventions were changed again, with follow on agreements. Thus, today, there are several laws in force which would make not only Hiroshima, but also Tokyo war crimes were they to happen today: One law specifically prohibits the use of air delivered incendiaries (ie fire bombs) in cities, another covers proportionality (making sure that if you are aiming at a military target in a city, you use the most reasonable method to obtain the effect on the target while balancing out the undesired effects on civilians), and another specifically prohibits making the civilian population the target of an attack.
In 1945, however, the rules were different.