There are several theories about why this happened.
The most accepted theory is that a giant asteroid crashed into earth around this time and caused catastrophic changes to the climate.
It was probably freezing cold and the dinosaurs could not adapt to the new weather conditions.