The Manhattan Project, which made the atomic bomb, was kept under the tightest secrecy practicable — FDR himself had mandated that it be kept more secret than even other secret war projects.
But to use an atomic bomb, and to hope it will lead to a surrender, necessarily means to reveal it. The bomb was used as a psychological weapon, a weapon meant to compel political outcomes by means of fear, and to fear it you have to understand it, at least a little bit. You have to believe it was actually used, that it is not propaganda, that it is truly "real."
So while the Manhattan Project labored on in secrecy to build a bomb, there were parts of it devoted to working out what they called the "Publicity" of the weapon — the plans for information release upon use. There were several philosophies driving this: 1. to scare/compel the Japanese into surrender, 2. to reveal enough information to corroborate the science fiction claims, 3. to give adequate credit to the people/industries/etc. who worked on the project, for fear that otherwise they would find ways to "take credit" publicly and potentially compromise secrets, 4. to make it clear what kinds of things were "safe" to talk about, both for people on and off the project, 5. to allow for an informed democratic public in the USA to make sensible decisions about domestic and international control of atomic weapons, and 6. to overwhelm the newspapermen so that they felt they had good stories to tell without digging around into areas that might compromise secrets.
So a very careful job was given to figuring out what was "safe" to release and what was not, and anything that was "safe" was released very widely and anything that was not, they threatened dire consequences if anyone who knew it got out.
There were a few phases of this program, but you can boil it down to basically official press releases, "planted" newspaper articles, a technical history of the atomic bomb, and a Public Relations Organization.
The official press releases, by President Truman and the Secretary of War, were labored over for tone, content, etc. Truman's release was not written by him; it was written by a PR expert (Arthur Page, the Vice President of AT&T). It was released within hours of the bombing (Truman was on the USS Augusta coming home from the Potsdam Conference, so he only "read it" out loud later). It gave some very basic information about the project, and is meant to be short and punchy. The Secretary of War's release had much more technical, logistical, and historical information and followed Truman's release by a few hours.
At the same time, the Manhattan Project officials released newspaper stories to the press that they were allowed to run, edit, rip-off, whatever. They were written by William Laurence, a colorful science journalist for the New York Times who was "embedded" with the project for several months. These stories covered all sorts of topics, such as how the bombs were made, where there were made, the personalities that made them, the secrecy itself, the July 16th test at Trinity, etc. They were meant to allow the newspapers to run non-stop coverage of the weapon without actually doing any serious research.
The technical history was released a few days after the Nagasaki attack, and not without some controversy. It had been written by Princeton physicist Henry DeWolf Smyth over the course of late 1944 and 1945. The Smyth Report, as it was known, was aimed at explaining the technical basis of making atomic bombs for an educated public, with the idea that it would help people understand the basic underlying principles. Again, this deliberately served a dual purpose: to inform people so they could make good decisions on how the control the bomb (e.g., to not believe it was a matter of just being a "secret," but a massive industrial process), but also to clearly delineate the boundary between that which was declassified and that which was classified (you can consider it the first "declassification guide" for the Manhattan Project — anything in the book is explicitly declassified, anything not in it is not).
And lastly, the Manhattan Project set up a Public Relations Organization at its headquarters in Oak Ridge, and essentially said, if you need stories, facts, have questions, etc., come to us first, and we'll help you stay safe and patriotic. And many journalists took them up on that. But not all. Journalists are journalists, after all, and they like a scoop, so this scheme, though largely effective, was not exactly perfect — some important secrets did "leak out," but mostly were missed among the noise.
You asked when did the public find out "the nature" of the atomic bomb. It assumes there is a single nature, a single collection of facts that describes it. I would just note that anything complex in the world, and the atomic bomb counts as that, has several natures. The public learned some of those natures immediately after the bomb was used — e.g., where it was made, how it basically worked (a nuclear chain reaction, etc.), who made it and why, etc. It did not learn all of those natures (how it exactly worked, e.g., the gun versus the implosion type design, how much fuel was in it, etc.; or the details of its deadly effects, some of which were not even yet fully understood by the scientists who had built it and would only be understood after months of study of the bombed Japanese cities). So some aspects of the atomic bomb were declassified and released immediately after it was used, some are still technically secret today but are actually known (e.g., the details of the design of the Fat Man bomb, which are not really declassified but are known from several sources), some are actually still secret today (e.g. the construction of the diffusion barriers for the gaseous diffusion plant). Secrecy is not a simple yes/no binary — it is a more complicated spectrum of knowing and not knowing.
Anyway. There's more to this story but the point I would emphasize is that the publicity of this was not at all haphazard, it was planned for months in advance. And I would also emphasize that these people understood, correctly, that secrecy is not just a matter of holding things back, it is also a matter of making a choice about what you release, and there are multiple reasons to do that. In the Cold War period the people in charge of weapons production called their philosophy Information Control, which was one part classification and one part public relations, which I think is a truly more effective way to think about this than mere secrecy.
My entire dissertation is on this stuff, as is my (someday) forthcoming book on the history of US nuclear secrecy, but if you would like to read an in depth discussion of just one angle of this (the Smyth Report), see a recent blog entry of mine.