Smoke is made up of carbon dioxide, carbon monoxide, water vapor, soot, and smaller amounts of many other molecules and bits of ash. Soot and ash are filtered by your nose, and pushed out of your throat when you cough. Carbon monoxide is toxic because it combines to blood cells instead of oxygen, and doesn’t let go, so your cells can’t get any oxygen to breath.
Carbon dioxide is something we breathe all the time, since it is a part of the air we breathe out of our lungs. Our bodies sense how much carbon dioxide is in our blood, and when the levels rise, we feel the need to take a breath. So breathing in too much carbon dioxide makes you want to breathe faster.
If you breathe in too much carbon dioxide, your blood becomes acidic, since carbon dioxide dissolves in water to form carbonic acid.
After breathing too much carbon dioxide, your body adjusts by making you breathe faster, so you breathe out the carbon dioxide. It is the build-up of too much carbon dioxide that makes you feel the intense need to breathe when you are holding your breath, or swimming underwater.