Winston Churchill wrote that
Might not a bomb no bigger than an orange be found to possess a secret power to destroy a whole block of buildings—nay to concentrate the force of a thousand tons of cordite and blast a township at a stroke?
(Winston Churchill's Imagination, 157), and I've seen stuff like HG Wells writing about atomic bombs, so it's clear that some people were aware of the idea pretty far in advance of the bombings of Japan...but how did the general public (on both sides) learn what an atomic bomb could do? Did photos of the mushroom clouds appear in newspapers (in Japan or the US), or pictures of the destruction? For the average Joe, was it a "ah someone finally did it" or "holy smokes!!!"?
The idea of atomic energy and even atomic bombs was discussed widely prior to Hiroshima. It was a major trope of science journalism and science fiction in the 1920s and 1930s, popularized alongside discussions of radioactivity. The way I like to frame it in modern terms is that it is analogous to a "warp drive" — pretty much everyone has heard of the idea of a warp drive and understands in very crude terms what it means (faster-than-light travel). A smaller number of people know anything about the science of it (e.g., the Alcubierre drive idea). If the US government announced that 16 hours ago it had driven a warp drive around Mars twice, you'd be shocked — you wouldn't really know how it worked, but you'd have a sense of it.
As for what they did after Hiroshima, the US government engaged in what they called a "Publicity" campaign about the atomic bombs. They fed dozens of news stories to newspapers that they could reprint or edit as they saw fit, they gave them photographs from the Trinity test, they eventually (when they had them) gave them aerial photographs of the destruction, and they published an entire book on how atomic bombs are made and worked (the Smyth Report) within days of the bombings. The goal was to saturate the news with information that would make people, including but not limited to the Japanese, understand what these things actually were, and what their implications were for the future. It was a major effort and one they had been planning since late 1944, because they feared that if the just used the bomb and did not control the media about it, they'd end up with a lot of leaks at best, and panic at worst.
They also dropped leaflets on the Japanese that explained that the atomic bomb had been used (but not in time to warn anyone at Nagasaki), so that they would understand it even if there was no Japanese press coverage of it. (As it was, there was some Japanese state press coverage, but it was not totally clear about what had happened.)