Because they have not got the sense to realise how downright dangerous it is. Apart from the obvious danger of being hit by a passing vehicle, it is likely they could get a foreign object in their eyes, or end up with streaming eyes from having dust etc. blown in them,leading to conjunctivitis.
So they rely on sensible caring owners not to allow them to do it (hopefully!).
Also because dogs use their sense of smell to communicate, so they are smelling the air as it goes past.