Protective secretion. Skin may become oily for a number of reasons. It has many small glands used to provide a thin covering of oil-like secretions often accumulated from proteins in the skin. This protects the skin from dehydration, bacteria and other elements. Depending on diet, health and genetics your skin may release more or less oil than the next person.
Oil-producing glands. The parts of the skin that have lots of hair (scalp, armpits, groin, etc...) also have oil-producing glands (called sebaceous glands). The oils made by these glands help keep the skin soft and water-repellent.