Ammonia is a Lewis base, and hydroxide is a stronger Lewis base. However, both are stronger Lewis bases than water is. Pure water always has some amount of "free" H+HX+ (it's actually hydronium ion) and OH−OHX− due to self-ionization (pKW≈14pKW≈14):
KW=[H3O+][OH−][H2O]2KW=[HX3OX+][OHX−][HX2O]2
When you add ammonia to the system, some of those hydronium ions (which are very strong acids) react with the ammonia to form ammonium. Since the concentration of hydronium decreases, the concentration of hydroxide must increase to maintain equilibrium. Those hydroxide ions are stronger bases than ammmonia is, and so they will "win" the tug-of-war over protons. However, in the meantime, some other hydronium reacts with some other ammonia, and the net result is a dynamic equilibrium in which there is more hydroxide then there would be in pure water.
The same mechanism is responsible for any other acid/base reaction where a base accepts protons from water and leaves hydroxide as a free species, but the net concentration of hydroxide will be different for different strengths of bases