The chemical reactions and pathways resulting in the formation of nicotinamide adenine dinucleotide, a coenzyme present in most living cells and derived from the B vitamin nicotinic acid; biosynthesis may be of either the oxidized form, NAD, or the reduce