Carbon monoxide (CO) occurs as a result of combustion taking place in an atmosphere where there is a shortage of oxygen.
It is a particular problem with engines which run ‘rich’, but even in engines which run ‘lean’ there will be localised areas of the combustion chamber where oxygen is deficient, especially in older design engines.
The main reason that carbon monoxide is considered a problem is because of its effect on people rather than the environment.
At relatively low concentrations (e.g. 100 parts per million) it causes headaches, nausea and fatigue. At higher concentrations or after prolonged exposure, unconsciousness and even death can be the result.
Because it is quite stable and has a similar density to air, it can build up dangerously in confined spaces, and to make matters worse it doesn’t even have a smell.