Each time your car runs, inside the engine there are thousands of small explosions happening. Each explosion produces power. It does this when it pushes against the pistons of the engine.
A side effect of the explosions is that, besides producing power, they produce leftover gas too.
The gas contains chemicals which are potentially dangerous. They include carbon monoxide, carbon dioxide, nitrogen oxides and hydrocarbons.
To stop the gases from entering the cabin and causing people to inhale them, they have to be directed away from the engine compartment. This is the primary function of a car exhaust system.
But modern vehicles have been designed for exhaust systems to do more. If exhaust gases go directly into the atmosphere, it causes them to affect more people. Not to mention, the non-stop engine explosions also produce noise pollution.
The car exhaust systems of today, have been designed to take care of all these problems.