The extinction of the dinosaurs occurred at the end of the Cretaceous period. The chief trigger for this was an asteroid impact, confirmed by both the structural evidence of a major impact in Mexico, plus the presence of iridium (from the asteroid) at the geological boundary worldwide.
It is straightforward to understand how all animals came close to extinction in the climatic chaos following this event, the difficulty is explaining why birds and crocodiles survived, but dinosaurs did not.
I suggest a hypothesis. There was a structural difference between dinosaur eggs and those of simple lizards. Their shells were more porous and so the scent of their contents was more easily tracked by the acute sense of smell of the developing mammals. Birds were able to place their eggs out of reach of these oviparous scavengers, but the massive dinosaurs were not. Nest after nest was tracked and devoured simply because the mammals succeeding in sniffing them out.
Poor dinosaurs, they’re not around any more because their eggs stinked.