The oil prevents (sort of) food from sticking to the pan or pot. The oil (indeed any type of fat), is an important flavour carrier. It makes food taste better by bringing out the flavours. Oil facilitates the Maillard reaction, which is how we get the lovely fried crust on the outer surface of fried foods.