If ozone is heavier than air and is affected by gravity then why doesn't it come near the surface of the earth.
It is(Ozone) found at the Earth’s surface, but in very low concentrations, mostly due to the effects of lightning, and of reactions involving pollutants.
But, to answer the question as intended, there are two reasons:
Ozone’s found in the stratosphere because it’s made in the stratosphere. Ultraviolet light “cracks” the O2 molecule into two O atoms. These free—and highly reactive—single oxygen atoms each then find an O2 molecule, and bond with it, forming O3. As our various atmospheric layers protect us on the surface from the vast majority of ultraviolet, this happens most at the highest altitudes that harbour O2;
Ozone is itself highly reactive. It doesn’t stay as ozone for very long. As soon as it can find something with which to react, it will do so. Stratospheric ozone will never find its way to the surface before reacting with something else.