Actually, they extract the jelly from petroleum.
Petroleum jelly is a mixture of hydrocarbon chains with lengths of 25 or more carbons. A hydrocarbon is just what it sounds like, a chain of carbons where every carbon has hydrogens bound to it.
The length of the chains determines whether the hydrocarbon will be a liquid, like gasoline (with lengths from 6 to 10 carbons) or mineral oil, or a solid, like paraffin wax (with 20 to 40 carbons in the chain). Petroleum jelly is in between, with around 25 carbons (there are a number of different molecules of different lengths in the mixture).
A crude black form of petroleum jelly was originally discovered by workers on oil rigs, as a gunk that fouled up the machinery. A chemist named Robert Chesebrough refined this into a white paste that has no color, odor, or taste, and marketed it as Vaseline in 1872.
As a grease that prevents skin from drying out, and keeping bacteria away from burns and wounds, Vaseline found many uses in the home medicine cabinet. It melts at a temperature close to human body temperature, so it becomes a near-liquid when applied to the skin.
You may know Chesebrough’s name through the brand Chesebrough-Ponds, now a subsidiary of Unilever. The brand includes Ponds Cold Cream and Cutex nail polish remover.