Dissolving CO2 in water creates some carbonic acid (H2CO3) that will decompose back to water and CO2 when the CO2 concentration drops. Blood has a fair bit of water, and carbonic acid is much easier to detect than oxygen or nitrogen gas
We evolved to detect CO2 because that's by far the easiest thing to detect that's still a reasonable proxy for the performance of our respiratory system