The sites/images are mainly those of/from Wikipedia.
Sections
A number of fairly unrelated chemical compounds are petroleum and vegetable oils---both categories are organic compounds---i.e., compounds containing carbon---but some such compounds are considered inorganic compounds.
Organic chemistry is the chemistry of life because the complex molecules that carbon can form can sustain the complexity of life as we know it.
We will just follow common practice USUALLYand use petroleum.
Organic oils certainly came first: oily secretions of plants and animals that are diverse in properties and chemistry which is complex.
Let's just consider three example oils.
The olive tree is native to the Mediterranean basin.
Wild olives were collected as early as the 8th millennium BCE by Neolithic peoples.
Credit: Willliam R. Shepherd, 1926 Historical Atlas (now public domain). Download site Perry-Casta~neda Library Map Collection. An excellent site for public domain maps.
Description English: Olive tree on Ithaca, Greece, that is claimed to be at least 1500 years old. Photo by Rien Post, june 2006.
Source: Transferred from en.wikipedia; transfered to Commons by User:Channel R using CommonsHelper.
Date: 2008-02-11 (original upload date) Author Original uploader was Channel R at en.wikipedia
Permission (Reusing this image): Licensed under the GFDL by the author; GFDL-SELF-NO-DISCLAIMERS; Released under the GNU Free Documentation License.
An olive oil press for crushing the olives to paste and draining off the oil.
There is a pretty elaborate procedure in general.
Screw-based presses used for olives and wine actually passed over to the printing press in Europe (printing press (history)).
Cooking like today.
Also as fuil in oil lamps oil lamps.
I assume there is a pore-hole and wick-hole.
It varies from yellow to brown in color.
It can be separated into a wax and true oil.
Whale oil can be used as a fuel in lamps or to make candle wax.
It can be used for cooking too.
Whaling (history) has a long history: whales being hunted for food, bone, and probably rather lastly for fuel oil.
There is also ambergris from the digestive tract of sperm whales which was once used in perfumes.
Probably such episodes were distinctly odorous.
But circa 1860, American whaling went into a sharp decline. In 1846 the US whaling fleet was 735 ships and 1876 it was 39 (Abraham Gesner by James S. Robbins). The last US whaling port, New sent out its last whaler, the John R. Mantra, in 1927 (whaling in America).
There were several reasons for this decline.
One was probably exhaustion of whaling stocks that could be hunted with old-fashioned Moby-Dick style methods.
Another was the probably the American Civil War and the western expansion that distracted capital and innovation from whaling.
But probably the main reason is that discovery of the method to distil kerosene from petroleum in 1849 (Abraham Gesner by James S. Robbins).
It's quite reasonable to argue as that this invention coming when it did saved the whales.
Improved whaling (history) technology in the later 19th century might 19th century might have doomed many species of whales if whale oil for lamp lighting and other uses had not been subplanted by petroleum products.
This illustrates SUBSTITUTIONS that have characterized much of human history.
A one resource gets substituted for by another.
Sometimes the new one is just better overall.
Sometimes the old one is being exhausted.
Sometimes fashions change.
In the case of whale oil is was the probably mainly the first with the second hard on it's heels.
Petroleum means ``rock oil'' and this term was used first in 1556.
However, the stuff itself was probably known in prehistory.
Mostly, it is seeleed underground.
But there locations particularly notably in the Middle East where underground pressure has forced deposits to the surface.
Of course, this is crude oil which is in general a mixture of hydrocarbons (compounds made up only carbon and hydrogen atoms). The properties of the mixtures will be various depending the composition.
It was used for illumination and medicine early on it seems in the BCE era.
Tar from Petroleum could be used for paving: e.g., Baghdad (see Petroleum History).
Petroleum was probably also used in making flammable military materials like Greek fire that the Byzantine Empire used in the Middle Ages.
A horrifying weapon in its day.