The Japanese initially did not know what had happened to Hiroshima because the bombing cut off contact with it. Military units nearby reported that it had suffered a massive attack and relief was promptly sent in. The survivors of Hiroshima did not really understand what had happened — many reported seeing only a single (or a few) bombs dropped, but none of them knew what an atomic bomb was, so they came up with variously incorrect interpretations of what had occurred.
Several hours later, the US began broadcasting propaganda statements about the use of the atomic bomb in Japan, and globally.
The Japanese had two modest fission research programs during World War II. They understood how an atomic bomb was supposed to work; this was public knowledge, in scientific circles, in the 1940s. The Japanese high command sent one of the top scientists on their fission work, Yoshio Nishina, to Hiroshima to confirm if it was indeed as the Americans claimed.
Nishina was able to tell, from both the evidence of the destruction and from radioactive residues, that it had been a massive explosion from a single source, and that it had been radioactive in nature. He cabled back to Tokyo:
What I've seen so far is unspeakable. Tens of thousands dead. Bodies piled up everywhere. Sick, wounded, naked people wandering around in a daze ... Almost no buildings left standing. ... I'm very sorry to tell you this ... the so-called new-type bomb is actually an atomic bomb.
The high command received Nishina's assessment on the evening of August 8, 1945.