It is also possible that it came to Vietnam by way of France. The French had their own 9mm subgun for their forces, but they were also sitting on a small mountain of nazi junk after WWII. I know they sold a bunch of it to Israel, I guess it is possible they sold/gave some to friendly forces in indochina. That stuff would likely have been up for grabs after the French left. The communists certainly used some of the captured French subguns, I doubt they would have any complaints about using third-hand MP40s.
"A human being is primarily a bag for putting food into; the other functions and faculties may be more godlike, but in point of time they come afterwards."