I thought of this because I have two kids, and they and their peers all knew the common dinosaurs but age three - those mentioned above plus Brontosaurus/Apatosaurus and Pterodactyl. Children's books and television seemed to focus on the same set of dinosaurs 30 years ago when I was a kid, too. But why those, and not any of the thousands of other dinosaurs discovered since the 1800s?
Were these the first to be discovered? The first to show up widely in museums? Was there an influential early book or movie that boosted their popularity, like Jurassic Park (1993) did for Velociraptor? I suspect there's some interesting history here.
Thanks in advance for any insight.
Tldr; big, scary, weird, and complete(-ish) => popular
It's not because they were the first to be discovered, but they were early and found during a key period in paleontological history. Iguanodon and Megalosaurus were the first described dinosaurs that still retain their initial names today (an end of a femur was called "Scrotum humanum" much earlier because the guy describing it thought it was a giant human's you-know-what (CORRECTION: See u/Balaur10042's comment below)). Before dinosaurs became popular, it was the pterosaurs (which are not dinosaurs), icthyosaurs, and plesiosaurs capturing peoples’ imaginations, thanks in large part to Mary Anning's fossiling. With two exceptions, all of the dinosaurs you mention were discovered and given those names during the Bone Wars era or not too far outside it. They didn't really know what Pachycephalosaurus was until later and specimens that belonged to it had different names before that. T. rex specimens were also first found during the Bone Wars era (and called Dynamosaurus imperiosus), but they were scraps only.
In part, it's a combination of their size as well as exotic and scary appearance making some of them easier to "sell" to the public, and the Bones Wars conflict adding a human element of interest. Hadrosaurus, found before the Bone Wars, doesn't look fierce and Pachycephalosaurus was a big, fat question mark for a good long while due to incompleteness. On the other hand, Brontosaurus/Apatosaurus has a fun background story that let people scoff at the less likable of the Cope and Marsh duo. And when the first partial skeleton was discovered later, it was clear that T. rex was the biggest land predator ever found, so of course it was going to make a splash. It still is the biggest if you go by weight instead of length (Giganotosaurus and Carcharadontosaurus are both slightly longer but would have weighed slightly less).
On top of that, when museums started mounting dinosaurs, they picked the skeletons that were mostly complete. That meant Tyrannosaurus yes, Pachycephalosaurus no. Hadrosaurus was the first one mounted, but again…not fierce-looking.
Then came the movies. Gertie the Dinosaur, featuring a Brontosaurus/Apatosaurus, was the first keyframe animation cartoon. Movies like The Ghost of Slumber Mountain and The Lost World showcased the now-famous Triceratops-Tyrannosaurus battles, and cemented the popularity of those two. I’m not sure where Stegosaurus came in. There are a couple other early dinosaur films I haven’t seen, only know about the Ghost of Slumber Mountain through the poster, and haven't seen all of Lost World.
FYI, there isn't a species named "Pterodactyl". There's Pterodactylus. Pteranodon is the actual name for what most people mean when they say "Pterodactyl". Both are types of pterodactyl, though (they're in the much larger group called Pterodactyloidea). Why this is such a common mistake, I don’t know.