And that main service rifle was often blamed for America losing...
Only by idiots.
Vietnam was an unwinnable war from the time US involvement started. Unlike Kim Il-Sung in Korea (a Chinese-raised guerilla who hadn't set foot in Korea for almost three decades when he was put in charge of the Soviet occupied zone), Ho Chi Minh was a genuine national hero for kicking out the French. Unlike Syngman Rhee in Korea (a near-fascist brute, but one who had been actively fighting Japan his entire life and had previous leadership roles in Korea before being picked to lead the American occupied zone), the leadership of South Vietnam (after 1963) was a fractured patchwork of coups and counter-coups held together by not very much. In any fair election, the country would have been reunified under Ho Chi Minh and everybody knew it.
Even ignoring this untenable political situation, the military situation was also untenable. Much has been made of the stupid way the US conducted the war, but this was fundamentally caused by geopolitical concerns - the measures needed to actually prosecute the war with a chance of success would have come very close to open warfare with the Soviet Union, which was a risk nobody was willing to take. At a tactical level US forces often did quite well, but wars are not won solely (or even primarily) on the battlefield.
Vietnam was a result of the US blundering into a war that should never have been fought and straight up could not be won.
Blaming the M16 was just one of the many excuses people came up with to say "well, we didn't
really lose!". It is true that the new rifle had serious growing pains, most of them not due to the fundamental design. Some were the result of cost-cutting (parts that were intended to be chromed had the chroming omitted to save money), others because Colt and Armalite weren't given enough warning to make changes in response to other changes (the loading for the ammunition changed - the cheaper and more energetic powder was also dirtier (exacerbated by the omitted chrome), and the barrel rifling didn't stabilize the altered round properly), and some were stupidity that bordered on (and may have been, from people who didn't want to change to the "Mattel Rifle") outright sabotage (troops were told that the rifle did not need cleaned, and no cleaning kits were issued). None of this fundamentally mattered for the course of the war, and most were fixed fairly early on.