The heart has different chambers to prevent the oxygen-rich blood from mixing with the blood containing carbon dioxide. The carbon dioxide-rich blood has to reach the lungs for the removal of carbon dioxide, and the oxygenated blood from the lungs has to be brought back to the heart.