Actually the M-16 pre-dates Vietnam.
It was an adaptation of the Remington .222 and .222 Mag cartridges.
Flat shooting, high capacity, accurate, with a light gun, what’s not to like.
The Air Force originally got them, for security work, their M-1 Carbines weren’t as good as other guns for guarding planes and such.
The Army ‘borrowed’ some and they were popular at least until after they were adopted and the ammo debacle.