The reason why both the air and the soil smell so good with that distinct smell after it rains is due to the bacteria that grows in the soil as well as plant oil, chemicals and bacterial mold spores that grow in the damp and warm soil.
The actual term for the distinct smell when it rains is petrichor and when the soil dries out the soil produces spores.
This is why you smell the rain and soil when it rains out.