Why is there an anterior and a posterior pituitary gland?
Pituitary gland is the master gland in our body and controls the functions of all other endocrine glands. It has three parts: anterior, intermediate and posterior. In humans, the intermediate gland is so small that we often consider only the anterior and posterior pituitary to be the parts of the pituitary gland. These two pituitary glands have different functions and are thus required for our sustenance and growth. The anterior pituitary synthesizes hormones, unlike the posterior pituitary. However, both of these are governed (through signals) by the hypothalamus. The anterior pituitary is responsible for growth hormone, thyroid stimulating hormone, follicle stimulating hormones (for normal functioning of testes and ovaries), prolactin (stimulates breast milk production), etc. Posterior pituitary is responsible for oxytocin (responsible for uterus contraction during childbirth) and anti-diuretic (responsible for increasing water absorption in the blood by kidneys).
Hope this helps.