There are lots of theories about why the dinosaurs went extinct and I think it was probably for a number of different reasons combined.
1) Asteroid collision; this is probably the reason people think of first. There’s geological evidence that a huge meteorite crashed into the Earth at what’s now the Yucatan peninsula in Mexico. Living things in the immediate area would have been killed instantly and the aftermath effects of debris and gases released into the atmosphere would have had a global impact on the climate. So dinosaurs either choked and suffocated immediately or their environments were so altered that they couldn’t survive for long.
2) Volcanoes; around the same time (roughly 65 million years ago) there were huge volcanic eruptions in India. The emitted gases created a huge global warming effect so the poor old dinosaurs were already feeling the heat before the meteorite hit.
3) Climate change; as well as the effects of volcanoes and the meteorite, the Cretaceous/Tertiary boundary when dinosaurs went extinct was also a time of major tectonic changes in the formation of the land, changes in sea level and sea currents etc. All these shifts contributed to climatic and environmental changes and the dinosaurs couldn’t adapt to their new environments.
4) They were tired! Dinosaurs first evolved around 230 million years ago so they were around for at least 165 million years before the major extinction. During that time many dinosaur lineages died out and new ones evolved. If you look at the fossil record there’s a constant trend for new species to evolve and old ones to die out. Around the time of the meteorite and the volcanoes, many dinosaur species were probably reaching the end of the natural evolutionary lifespans any way. It’s also hard to tell from the fossil record exactly when the last dinosaur died – their extinction was probably spread out over millions of years. This is a tricky idea because it’s hard to define exactly how long you should expect a species to survive before going extinct but it does make sense that, since the environment is constantly changing, you can’t expect species to remain well-adapted and survive forever.
So I think dinosaurs died out due to a combination of all of these factors, and probably other ones we haven’t discovered yet.
And remember, not all dinosaurs died – all modern birds are really just feathered dinosaurs!