The first nuclear bomb was detonated in New Mexico on July 16 1945
The test was part of the US government's Manhattan Project whose goal was to develop nuclear weapons before the Nazi Germany could do it. The device tested was of the same design as the bomb detonated over Nagasaki, an implosion type plutonium bomb. At their core, such bombs have a hollow plutonium sphere covered with honey comb shaped chemical explosives from every direction. When the chemical explosives are detonated at precisely the same time, the sphere is crushed into a solid one and critical mass is attained. Critical mass is the smallest amount of fissile material enabling sustained nuclear chain reaction. It depends on the shape of the object which is why it is always a sphere in bombs because critical mass is at its smallest for a spherical object. The fissile material in question was Plutonium-239
The Hiroshima bomb did not need to be tested as badly as the Nagasaki bomb because it was a so-called gun type device where two hemispheres made up of bomb-grade enriched uranium (of which at least 20% is the fissile isotope Uranium-235) are fired using chemical explosives from the opposite ends of a metal tube causing them to meet in the middle. The hemispheres stay together long enough for the chain reaction to have time to produce a significant energy yield for a bomb.
Plutonium bombs have better energy yields per unit of mass but Pu-239 has to be made in a nuclear reactor. Uranium ore occurring in nature contains only 0.7% of U-235 but because naturally occurring Uranium is nearly entirely U-238 which has three neutrons more than U-235, it is easier to separate. Because of the ubiquity of uranium in the Earth's crust, the relative ease of enrichment and the ease and low cost of bomb construction, gun type uranium bombs are the weapon of choice of all aspiring nuclear power such as North Korea.
Here's footage of the Nagasaki bomb, code name Fat Man: