Odour is not a property of the substances: it's a property of our smell sense, a property obtained through millions of years of smell receptors evolution. The substances that have characteristic odours are uually related with food or danger. Ammonia is a product of decomposition of organic aminoacids through decay via microorganisms. Its smell indicates the animal (us) that something is rotten, so it is better not to eat it. But for an organism that can eat rotten food, ammonia is not an unpleasant odour, it could be even an indication of "free food". The physicochemical nature of any odour (i.e. ammonia) comes from the match between a protein (the receptor at the olfative bulb) and the odorant (ammonia in this case). If it matches, a neural impulse is generated and higher regions of the brain integrate this information into "ammo nia smell".
The answer of Professor Roberto Etchenique is correct as far as I know. There is the sender-receptor interaction. I just like to add that a bottle containing ammonia will have the gas dissolving in water, as you know, by this equation:
NH3 + H2O NH4+ + OH− . Of the 4 species, represented by the equilibrium equation, the one which has the highest degree of mobility freedom is ammonia so it comes to the smell organ to interact.