Petrichor: The earthy scent produced when rain falls on dry soil is called petrichor.
The scent is caused by two things:
1)Bacteria: Soil-dwelling bacteria called actinomycetes produce spores in the dry soil. When rain falls on these spores, it displaces them. The moist air carries these spores, so we’re able to smell them.
2) Plants: Certain plants and trees release oil that gets collected on soil and rocks. The rain causes this oil to be displaced in the air, and that sweet smell is also carried to our eager noses.
There is one final reason: the infamous Ozone layer is another reason behind the sweet smell of rain.