Coal is a rock that is high in organic carbon, mainly from plant leaf material. It was formed in low-lying wetlands and marshes.
Oil is a liquid hydrocarbon, that is usually formed when an rock high in organic carbon is subjected to heat and pressure. A number of different types of Source rock can produce oil, including coal.
Coal, as a solid, is mined. Oil, as a liquid, can be produced by drilling.
Coal and oil both have a relative high Energy density and are relatively easy to transport and handle at room temperature, which makes them useful as fuels.
Coal is usually used directly, with little processing. Oil is usually refined, to split it up into components that are suitable for use in specific types of engine.
Oil - as a higher energy density liquid - tend to be preferred as a fuel for transportation, mainly because you need to carry a lower weight in fuel, and can easily pump it into the engines automatically.
Coal tends to be preferred in static situations such as electricity generation because it doesn't require a container, and can be easily stockpiled.