Why do we write NH3? We've learnt that the electropositive element is written first. Then why is ammonia written as $\ce{NH3}$ ?
According to current nomenclature rules, $\ce{H3N}$ would be correct and acceptable.  However some chemical formulas, like $\ce{NH3}$ for ammonia, that were in use long before the rules came out, are still accepted today.