Dogs chase cars for the same reasons they chase kids on bikes, cats, small animals and other Dogs: They are either playing a game or they are hunting.
To a greater or lesser degree, chasing involves a dog's natural prey drive.
The object isn't necessarily to catch the other dog; the real fun is just running around.