With any internal combustion engine, the goal is to take hydrocarbons and oxygen to produce hear, water, and CO2. CO is generated when you have incomplete combustion, which mostly happens when there is not enough oxygen. Google AP-42 to learn a bit about the physics and chemistry involved (engines are in chapter 3). To maximize CO you want to have a low air to fuel ratio (I.e. less than stoichiometric air). Gasoline and natural gas 2-cycle engines, rich burn, low air, and low combustion zone temperatures are usually the culprits when CO is high.
High CO also means lots of products of incomplete combustion, so sunburnt fuel and other hazardous organic compounds will be emitted (e.g. benzene, Charlene, hexane) it will smell pretty bad and irritate your respiratory system.
You also run the risk suffocation if you run an engine in an enclosed area and there isn't a supply of fresh inlet air. The engine will use up the oxygen in the area (like when you put a match in a sealed area).
Sorry for typos, I'm not great typing on my tablet and the dictionary doesn't know science terms very well.