In general, crude oil is refined to produce diesel and petrol.
Crude oil is made up of different types of hydrocarbons and other impurities.
To produce diesel or petrol, these hydrocarbons need to be separated by a process known as fractional distillation.
Fractional distillation is the separation of a mixture by heating into its fractions or parts. The longer the hydrocarbon chain, the higher the boiling point. Each part is captured as a vapour then recondensed.


Here is a great video on how crude oil is refined to produce fuel and other products:

There is debate over which is better, petrol or diesel?
Some of the pro’s of diesel are: great mileage, longevity of engine, high torque, potentially lower fuel cost overall.
Advantages of petrol are: delivers instant power, lower fuel price, generally less expensive too service
Crude Oil Composition
Fractional Distillation