The simplest explanation for why traffic waves happen is that drivers have relatively slow reaction times: if the car in front of you suddenly slows down, it’ll likely take you a second or so to hit the brakes. The slower your reaction time, the harder you have to brake to compensate and keep a safe distance. The same goes for the car behind you, which has to brake even harder than you did in order to slow down faster. And so on down the road, in a domino-like effect.

Hit the brakes in the simulation, and you’ll see what happens. Naturally this is a simplified version of traffic conditions and assumes some things about how people drive and react, but you’ll get the idea.