I know that Germany and several other countries were secretly working on the A bomb for a few years. But did the average person know that there was this potential weapon out there with huge destructive capability? Or the day after the bombing did most people read the newspaper and learn for the first time about the existence of atomic weapons?
I don't make this post to disagree with the other posters, but the original question contains this:
Or did it [atomic bombing] catch everybody by surprise?
Not everyone was taken completely by surprise with the atomic bomb. In a speech to the Pontifical Academy of Sciences in February 1943 Pope Pius XII addressed the possibility of an atomic bomb. (source in Italian)
di maniera che il pensiero della costruzione di una macchina di uranio non può essere stimato come una mera utopia. Soprattutto però sarebbe importante che non si lasciasse effettuare tale processo a modo di esplosione, ma che se ne frenasse il corso con adatti e vigili mezzi chimici. Altrimenti ne potrebbe seguire non solo nel luogo stesso, ma anche per l'intiero nostro pianeta, una pericolosa catastrofe. (emphasis added for clarity)
The thought of the construction of a uranium machine cannot be regarded as merely utopian. It is important, above all, however, to prevent this reaction from taking place as an explosion ... Otherwise, a dangerous catastrophe might occur.
After the atomic bombing, the Vatican did issue a statement via the Osservatore Romano opposing the bombing, which was consistent with its ongoing condemnation of aerial bombardment of civilians (dating back to WWI, and continued from the very beginning of Pius XII's pontificate).
So Pope Pius XII was aware of the possibility of atomic bombs. I don't know if he would fit OP's criteria of being part of the "general public" though.
No — the theoretical possibility of an atomic bomb was known within scientific circles, but wasn't widely understood by the public at large.
In August 1939, Albert Einstein and Leó Szilárd wrote (privately) to President Roosevelt, alerting him to recent developments in the field of atomic research in Germany and warning of the destructive power of an atomic bomb:
This new phenomenon would also lead to the construction of bombs, and it is conceivable — though much less certain — that extremely powerful bombs of this type may thus be constructed. A single bomb of this type, carried by boat and exploded in a port, might very well destroy the whole port together with some of the surrounding territory.
Subsequently, both the British and American governments established committees (the S-1 Uranium Committee in the US and the MAUD Committee in the UK) to explore the feasability of developing atomic weapons. The work of those committees — both operating under military auspices — was kept secret.
Prior to August 1945, the existence of functional atomic weapons and the intensive effort that went into developing them were jealously-guarded military secrets. The Manhattan Project and comparable nuclear research projects outside the US (Tube Alloys in the UK; the German Uranverein and Laboratory No. 2 in the USSR) were shrouded in secrecy — not least because they were fiercely-contested targets for espionage.
The existence of atomic weapons only became public knowledge on 6 August 1945, when President Truman released a statement announced the bombing of Hiroshima to the world:
Sixteen hours ago an American airplane dropped one bomb on Hiroshima and destroyed its usefulness to the enemy. That bomb had more power than 20,000 tons of TNT. It had more than two thousand times the blast power of the British "Grand Slam" which is the largest bomb ever yet used in the history of warfare.
[...] With this bomb we have now added a new and revolutionary increase in destruction to supplement the growing power of our armed forces. In their present form these bombs are now in production and even more powerful forms are in development.
It is an atomic bomb. It is a harnessing of the basic power of the universe. The force from which the sun draws its power has been loosed against those who brought war to the Far East.
Six days later, the US government released the Smyth Report, a carefully-crafted account of the development of the bomb that answered fundamental questions about atomic weapons without giving away too many specifics.
About a dozen German scientists were captured while the war was still going on in the Pacific. They were confined to a house that was bugged. No one really knows how aware they were of any type of listening devices. It was new technology so it wasn't really thought of, but at the same time several of these scientists were suspiciously quiet. Regardless, Heisenberg was among them and the transcripts show how suprised he was.
I bring this up because you mention how Germany had their own program. While they did, Hitler and other higher ups thought of it all as Jewish Physics, their programs were severely underfunded. Heisenberg's own plan for splitting the atom was also incorrect and he believed it would have taken 100's of thousands of people working non stop to achieve what the US had supposedly detonated over Japan. So yea, even German scientists were surprised and their jobs were to achieve this, even though almost none of the funds they needed were directed towards them.
Edit: Operation Epsilon
No. If you ever read about the Enola Gay (Plane that dropped the first atomic bomb) even the crew was not aware of what the bomb was. They knew it was different, usually a bomb bay had a ton of bombs not just one big one, and from what I can tell they knew it was an "atomic" bomb. But they didn't really know what that meant.
Apparently the flight log for the bombing mission was pretty unusual, it goes from the usual descriptions of clouds, weather, and turbulence, to an entry that said something like, There will be a brief pause as we make our bombing run. Then the next entry was "My god, what have we done?"
This hints pretty strongly that even if people were aware of the highly classified bomb projects, they probably did not have any degree of understanding unless they had witnessed a bomb test.
The concept of an "atomic bomb" had been a science fiction staple since 1914. It was based on the idea that there was tremendous amounts of energy locked up in the atomic nucleus, if only it could be released. By the early 1930s it had become a cliché idea, that a thimbleful of water could power a steamship across the ocean, etc. Much of this discussion was a result of the popularization of nuclear research and the science of radioactivity by scientists like Frederick Soddy and novelists like H.G. Wells. Even a younger Winston Churchill gave a speech referencing atomic bombs in 1925:
Might 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?
The problem was that until the discovery of nuclear fission there was no physical mechanism for releasing that energy on a large scale. It is one thing to say that the energy in the atomic nucleus, it is another to be able to release it. (To put it into a modern context, we all know that anti-matter/matter reactions release immense amounts of energy. But this is not helpful to us, since we have no way of easily producing anti-matter. So talk of an anti-matter bomb today is as fanciful as talk of an atomic bomb was in the 1920s.)
Nuclear fission was discovered in the winter of 1938, and announced in early 1939. The science writers powered up their cliché engines once again and started talking about bombs and thimblefuls of water and what have you. Some actual scientists got worried (Leo Szilard being one of the first, a fact he attributed to his reading of H.G. Wells), but a lot of them (including some very brilliant and later important ones, like Enrico Fermi) dismissed it as a short term problem, in part because of the long history of overhype.
But there is a big gap between "discovered in a lab" and "realized as a weapon." Aside from the people working on the Allied Manhattan Project, the general consensus among scientists was that this would be maybe an issue for the next war, because turning a discovery into a technology takes several years, if not a decade.
So when the atomic bomb did occur, there was already a lot of cultural "priming" to understand it — the term "atomic bomb" was not a new creation. But it was surprising that it was achieved when it was.
The analogy I like to use is that of a "warp drive." Almost everyone has heard of such a thing. Geeky sorts know that there are some hypothetical, real-life ways of potentially accomplishing it, but nobody thinks one is right around the corner. Now imagine that the government announced tomorrow that they had achieved a warp drive and used it to go around the solar system three times. You'd be shocked — and you might be curious as to how the hell they did it — but it would not be the first time anyone had heard of the general concept.
Well it depends on what you mean by "the average person". If you include readers of the American fiction magazine Astounding Science Fiction, then yes, they were aware of the possibility. A little over a year before (in the March 1944) issue, Astounding published a story called Deadline which described the building and detonation of an atomic bomb powered by isotope separated U235. The information was based on publically available technical journals up to 1943 and the editor's background in physics.