Products of combustion
CO and CO2 are products of incomplete combustion.
Combustion is a by-product of oxidation, rapid oxidation generates heat and visual flame, the more rapid the oxidation the more complete the burn. In a confined atmosphere this can lead to explosion.
You can play around with oxidation and complete burn with something as an oxy acetylene torch set. Turn the O2 down and light just the acetylene you will get incomplete combustion so great that it creates soot. Now start adding O2 to the mix, first the "smoke" will disappear then the color of the flame will change.
It is possible to get such a complete combustion that it produces no CO or CO2 or other by products for that matter. An example of this would be in almost every restaurant you have what is called a direct fired make up air system. This has to be adjusted to a point that combustion is so complete that it produces a byproduct with the same breathing quality as air.
[I digress] in very basic terms the higher the O2 content more complete the burn. Or the more heat from oxidation the closer the fuel gets to its flash point at its flash point then combustions is complete with no by product from that fuel.
I could tell you some great stories about flash over, back drafts, and just watching products of combustion [smoke] from a fire ignite over your head [roll overs]
How does this all relate to diving, the higher the O2 percentage or pressure the more that the product it is in contact with is oxidizing, when that product starts oxidizing it starts to generate heat, as that heat increases it the product will reach its ignition point and start to burn resulting in flame. That flame can be represented in a slow burning ignition [fire], or can be displayed in a violet rapid ignition [explosion].
This is a simplified description and there are other factors and parameters involved which we don't need to go into here.