I know that volatile substance creates smell but how a good smell produce? Is there any common characteristics of the compounds having good smell?
There is a very wide variety of chemicals that have a good smell - and the flavor and fragrance industry has discovered and profited from thousands of them. To have a good smell, a compound first of all has to be low molecular weight and able to easily evaporate into air so it can be carried to your nose--i.e. a "volatile organic compound". Esters are a good class to look at for starters, and are responsible for many of the fruity odors. For example, amyl acetate is a simple compound, easily made in the lab, that smells like bananas. Another important class is terpenes: hydrocarbons made from 5-carbon units that include pine and cedar odors. Some odor components like those of chocolate are more complex, have many components, and are hard to reproduce exactly.
One way to think of good (and bad) smells is how over time animals and humans have evolved to appreciate the smells of some things (like fruit or cooking onions) as good and other things like rotting flesh as bad, since the former is good for you and the latter definitely bad. If you got it backwards, you would not survive for long. But flowers, for example, smell good but do not materially benefit us. Maybe we have some residual bee genes in us.