The nucleotides have to be reactive in order to make that phosphodiester linkage. The 3' of the ribose molecule is a nucleophile and essentially attacks the first phosphate on the next nucleotide as a nucleophile. The leaving group is the pyrophosphate. So, these molecules have both nucleophiles (alcohol 3') and electrophiles (the first phosphate group). These are energetic molecules. However, we are organizing them into DNA which decreases entropy. We need an enzyme like DNA polymerase to catalyze this. The hydrogen bonds that form between the bases helps make this favorable.
These energy molecules (dnTPs) are not for free, however. They come from the pentose phosphate pathway starting with glucose!