Why does ammonia react with water to produce hydroxide?
The shortest answer is "because the change in free energy is negative," but maybe you want to know how the mechanism works?

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" $\ce{H+}$ (it's actually hydronium ion) and $\ce{OH-}$ due to self-ionization ($pK_W \approx 14$): 

$$
K_W = \frac{[\ce{H3O+}][\ce{OH-}]}{[\ce{H2O}]^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.