During diastole the atria fill with blood. This increases the pressure in the atria, opening the atrioventricular valves. During atrial systole the two atria contract, forcing blood through the atrioventricular valves into the ventricles.
A short time after atrial systole, the ventricles contract. This increases the pressure in the ventricles, causing the atrioventricular valves to close. It is the blood slamming these valves that causes the 'lub' heart sound. Blood is forced into the aorta and pulmonary arteries, opening the semilunar valves. The cycle repeats, returning to diastole.
Blood from the body enters the right atrium and blood from the lungs enters the left atrium, filling them as they relax. The atrioventricular vavles are pushed open by the increased pressure in the atria. The semi lunar valves are initially open but as the ventricles relax blood falls back from the aorta and pulmonary artery causing the semi-lunar valves to close. It is the blood hitting the valves that causes the sound 'dub' heard with a stethascope.