Only a very small amount of people from a handful of countries have seen an actual nuclear explosion. How then did the public became aware of the shape of the distinctive mushroom cloud that is now synonymous with nuclear weapons?
The short answer to "how did they know what it looked like" is somewhat boring: photography. Immediately after the attack on Hiroshima there were photos of the Trinity test released to the public, as well as first-hand accounts of it, followed in time by images of the mushroom clouds from Hiroshima and Nagasaki, and even film clips of the Trinity detonation. Similarly in the Cold War there were many photographs of nuclear tests released, and they were reprinted widely.
I thought you were going to ask when people started calling it a "mushroom cloud," because there are other ways to describe the phenomena (a "column of smoke" was the most common depiction from the Trinity test and survivors of the atomic bombings, and people reached for all sorts of other visual metaphors, such as a "cauliflower" shaped cloud, even a "raspberry"), and many times at which you can take a photograph of a nuclear detonation that do not look mushroomy (such as the early fireball). But saying the cloud was "mushrooming" became the dominant metaphor, even in the early days, and it has been suggested (by the historian Spencer Weart) that there are deep cultural connections between mushrooms and death (toadstools, damp rot, etc.), as well as life (transmutation, food, etc.). See Spencer Weart, Nuclear Fear (1988), 401-403. It is of note that the term "mushroom cloud" does not become especially common, according to Google Ngrams, until the 1950s.