The main function of the circulatory system is transporting blood, oxygen, hormones, nutrients and other important substances throughout the body. The circulatory system is actually two separate systems of circulation, pulmonary and systemic, both of which interact with the heart and cardiovascular system to pump blood throughout that system.
The pulmonary circulatory system is the smaller of the two, as it only runs from the heart to the lungs and back. It's main function is to absorb oxygen from the lungs into the bloodstream, after which the oxygenated blood is pumped back to the heart. After entering the heart, the oxygenated blood is then sent throughout the rest of the body by systemic circulation.
The heart is split into four chambers: the left atrium, left ventricle, right atrium and right ventricle. The oxygen-depleted blood that leaves the heart on its way to the lungs does so through the pulmonary artery, which is located in the right ventricle. The oxygen-rich blood that circulates throughout the rest of the body leaves the heart via the aortic valve in the left ventricle.
Blood always follows the same path through the circulatory system, with blood first traveling to the lungs to get oxygenated and then back to the heart. From there, it goes throughout the body to provide oxygen to the cells, before going back to the heart, and then the lungs again, to replenish the level of oxygen.