The circulatory system takes food and air from outside your body and brings it all over your body so that all your cells get the food and oxygen they need to stay alive. The earliest cells, about 3.8 billion years ago, didn't need any circulatory system. They had only one cell, so they could get their food and carbon dioxide directly from the ocean all around them.
Around 600 million years ago, when the first multicellular creatures developed like hydras and jellyfish, they formed themselves into the shape of a bag, and that way the ocean water could still get to both the cells on the inside of the bag and the cells on the outside of the bag.
But about 550 million years ago, bigger, thicker animals evolved; first flatworms, and then roundworms. The worms needed not just one bag, but a series of tubes leading off from that bag, to carry ocean water all over their bodies. To move the salty water through these tubes, and have it come back again to get more food and oxygen, part of the tube was made of muscle that could push the blood along. Instead of the salty water moving in and out of their bodies, segmented worms evolved a closed system, where the blood stayed in and the sea water stayed out. In certain places - the gut - the blood ran up against the seawater, and pulled food out of it. Blood is really imitation ocean water, still carrying food and oxygen to your cells just the way the earliest cells got their food. But worm blood looks red because it has iron in it. The iron binds to the oxygen and provides an easy way to carry the oxygen in the blood.
By about 500 million years ago, fish developed gills. When the fish pumped blood over its gills, the blood could pick up oxygen more efficiently than before, so fish had more energy and could be more active than other sea creatures.
When lungfish developed into frogs and came up on land, about 340 million years ago, the frogs gave up their gills for lungs. Now they needed to get oxygen from their lungs all over their bodies. Frogs began to send the blood with oxygen in it back to the heart again, to be pumped out more strongly all over the body.
Reptiles developed a heart with a little dividing wall, so the blood with oxygen wouldn't mix with the blood without oxygen. But mammals and birds both evolved hearts with really separate chambers to keep the oxygenated blood separate from the blood without oxygen. This is a much more efficient way of using oxygen, and that's one reason that mammals and birds have more energy than reptiles and we can run faster, stay awake longer, and generally get more done.
A few people are still born without that separation in their heart, but today doctors can fix that with an operation.
Nervous system and senses