What was the reason for them not targeting the capital of Japan? If they took out Tokyo, Japan would have been crippled and more likely to surrender after the first one was dropped.
So what was the reason for the US Army to target Hiroshima and Nagasaki instead of Tokyo?
The planning as to where to drop the bombs was done primarily by a Target Committee that consisted of representatives from scientists, the military, and the world of policy. They decided in Spring of 1945 that the targets should be urban areas that were un-bombed, so that the unprecedented force of the bombs could be easily seen, and that they should focus on places that had some kind of military connection, so that they would not look like they were wantonly killing civilians for its own sake.
They only briefly noted that Tokyo of course could be a target, but deliberately noted that they would not spend time thinking about it unless they were directed to. Tokyo was the political center, of course, but it was also heavily bombed, and there were some concerns that if you killed the Emperor and high command, figuring out how to procure a total surrender from whatever successors there would be would be a difficult matter. They were hoping that the Emperor and Supreme War Council could be compelled to surrender, and that involves not killing the Emperor and the Supreme War Council, at least not as the opening salvo.
The top targets they looked at were Kyoto, Hiroshima, Yokohama, Kokura, and Niigata. Yokohama got firebombed shortly after they looked at it, and was removed from the list. Kyoto was their initially-preferred target, but the Secretary of War vetoed it (there's a long story there). That left Hiroshima, Kokura, and Niigata. To have another target in the flight area of Hiroshima and Kokura, they added Nagasaki on the day that the bombing order was finalized.
The bombing of Hiroshima went as planned; the bombing of Kokura did not, and Nagasaki was instead bombed as the back-up target. A third bomb was being prepared, and there were indeed many voices suggesting that Tokyo ought to be the third target, but it didn't get to that stage of planning. So it's not impossible that Tokyo could have been atomic bombed, had the other bombs not "done the trick."
It is worth noting that Japan was already "crippled" by August 1945. They were militarily defeated, but had not surrendered. There is a difference between the two, and much of the efforts in the late summer of 1945 were about trying to bridge that gap. Killing the leadership is not necessarily the best way to do that, because it introduces tremendous uncertainty into the equation — if, for example, more junior military officers seized command of the country (not impossible), they might be more inclined towards a fanatical last-stand than the Emperor and more experienced politicians and officers might have been.
There's a lot that can be said about targeting issues; I think Sean Malloy's "‘The rules of civilized warfare’: Scientists, soldiers, civilians, and American nuclear targeting, 1940–1945," from The Journal of Strategic Studies (2008), is the best all-in-one coverage of the targeting issues. Some of these are also discussed in my recent article on the Kyoto vs. Hiroshima question.
There are many answers to this question. Most of this comes from the Decision to Drop the Atomic Bomb by Gar Alperovitz.
First, keep in mind that the bomb had never been used in war before. Nobody really knew what kind of damage it would do. Dropping it on desert sand and fake buildings in New Mexico is one thing. Dropping it on a functioning city is quite another. They wanted to see what type of damage the bomb can really do. They could not do that in Tokyo since the U.S. had been bombing the city consistently since 1944. Parts of Tokyo were already wastelands. It would be impossible to tell what damage was done by the atomic bomb and what damage had been done before. The U.S. wanted to show off the power of the bomb to Japan (and the Soviets) and the best way to do that was to use an untouched city as a demonstration. Hiroshima and Nagasaki were two of the medium-sized cities that had been relatively untouched by American bombing up until that point.
Furthermore, Tokyo was the home of the emperor. The Japanese Emperor was a God-like figure. If he was killed or injured during the bombing, that would probably make the Japanese even more intractable and willing to fight. Many high-ranking Japanese officials were already signaling they'd be willing to surrender as long as they were able to keep their emperor. The U.S. did not want to risk killing/harming the emperor and destroy any hope for a surrender after the bombing.
The Japanese had also moved American POWs into cities the U.S. had been bombing in hopes of using them as a human shields of sorts. Hiroshima and Nagasaki had relatively few POWs. This played less of a role in the decision-making but it was a factor.