Hi there!
Trees get their nutrients from the soil via the roots, as well as, getting the needed fuel from photosynthesis via the leaves. The soil contains many different minerals and it also contains nitrogen. The roots of a tree also absorb water.
-Your friend, ASIAX