Catalyzes the epimerization of UDP-N-acetylglucosamine (UDP-GlcNAc) to UDP-N-acetylgalactosamine (UDP-GalNAc). Has very low epimerase activity with UDP-Glc and UDP-Gal. Plays a role in the biosynthesis of 2-acetamino-2-deoxy-L-altruronic acid, a building block of the O-antigen in bacterial lipopolysaccharide (LPS). UDP-N-acetyl-alpha-D-glucosamine = UDP-N-acetyl-alpha-D-galactosamine Binds 1 NAD(+) per subunit. kcat is 461 sec(-1) with UDP-GlcNAc. kcat is 1038 sec(-1) with UDP-GalNAc. Optimum pH is 7.0-9.0. Optimum temperature is 37 degrees Celsius. Bacterial outer membrane biogenesis; LPS O-antigen biosynthesis. Homodimer. Belongs to the NAD(P)-dependent epimerase/dehydratase family.