Haemoglobin is a protein made up of 4 sub-units. Each sub-unit has a molecule of un-oxygenated Iron. Oxygen covalently bonds to the Iron and is thereby carried by the blood as Oxy-haemoglobin. Oxy-haemoglobin releases its oxygen in areas of the body where it needs.
In these areas of the body Carbon Dioxide is present in higher quantities than Oxygen and so binds in the same way to Haemoglobin, thus creating carboxyhaemoglobin. This carries carbon dioxide to the lungs where it is released.