Oil is made of tiny plants and animals that lived in warm seas. As they died, they were slowly buried beneath the mud of the sea-bed. The heat from deep underground and the increasing weight of mud above turned them into oil. The rock holding oil is porous - it has holes like a sponge. Pressure forces the oil up until it meets solid, non-porous rock, when it becomes trapped in a huge pocket underground.
Oil usually comes out of the ground as thick, black crude oil.
An oil refinery processes crude oil.