What determines the order of nitrogen bases in DNA?

The two chains are connected by hydrogen bonding between nitrogen bases to form a long double-stranded molecule.

So hydrogen bonding determines which nitrogen bases form pairs of DNA.