Dear Student,
Coal is a natural dark brown to black graphite like material formed from fossilized plants. Coal was formed from the vegetation that got buried inside the earth and was again covered by dead plants and the process went on throughout the carboniferous age until wood was converted into coal under high pressure and temperature.
Petroleum is crude oil (raw oil) which contains hundreds of different types of hydrocarbons all mixed together. It is a thick black liquid and is of little use. It was formed millions of years ago from the dead organisms of the seas.
Sea organisms died and got accumulated at the bottom of the sea. In course of time, sand and clay got deposited over these dead organisms. Over a period of millions of years, a thick layer was thus formed. This thick covering of sand and clay compressed the organic material. Under conditions of high pressure and temperature, this organic material, over millions of years, got converted into petroleum.
Regards