When oil comes out of the ground it is a brown mixture of many substances. To separate them, they need to be boiled.
Each substance in the mixture has its own boiling point, so you let the gases cool and they will condense into liquids again. Then you collect the liquids as they condense. Many of these liquids can be used to make plastics.
Common plastics include polythene, vinyl (PVC) and polystyrene.