In 1903, Elmer Riggs' re-examination of Marsh's specimens led him to conclude that they represented the same genus (although see below), meaning that the names were synonyms. In such cases, the ICZN (International Commission on Zoological Nomenclature, see www.iczn.org) mandates that the oldest name has priority - which means that the rather dull Apatosaurus (``deceptive lizard'') wins out over the much more resonant ``Brontosaurus'' (``thunder lizard'').
So why does the world still talk about ``Brontosaurus'' all the time? The paper in which Riggs established the synonymy was published in the Geological Series of the Field Columbian Museum - a relatively obscure journal, so the findings were not as widely known as they should have been. Also, the sexier invalid name received a lot of public exposure from non-scientific sources: for example, the Sinclair oil company used a ``Brontosaurus'' as its logo for many years. (Rather inappropriately, as it turns out, since oil is formed from plant matter, not animals. Never mind.)
So the world continued and continues to use ``Brontosaurus''; but Apatosaurus should be used in all serious writing.
I said that Riggs established that Apatosaurus and ``Brontosaurus'' were from the same genus. But the two Marsh specimens are still considered to represent separate species: the older specimen is Apatosaurus ajax and the newer Apatosaurus (nee ``Brontosaurus'') excelsus. However, since it's always a judgement call whether any species belong in the same genus (see ``When is a new dinosaur erected as a new species or genus?'' ), there are palaeontologists - notably Robert Bakker - who feel that the two species are sufficiently distinct that excelsus merits a separate genus. Under this scheme, the old genus name is still perfectly good, so Bakker still uses the formal name Brontosaurus excelsus (but never Brontosaurus ajax.)
Finally: for many years, Apatosaurus was believed to have a head similar to that of Camarasaurus - a mistake that was rectified in the 1970s with the discovery of a specimen with associated cranial remains closely resembling the head of Diplodocus. This has led to a misapprehension in some quarters that the name ``Brontosaurus'' refers to the combination of an Apatosaurus body with a Camarasaurus head. No so: the naming confusion is quite separate from this issue.