When the Burmese posts were translated into English on Facebook, Mr. Xi’s name repeatedly appeared as “Mr. Shithole.”
It was not clear how long the issue lasted, but Google’s translation function did not show the same error, Reuters reported.
Andy Stone, a spokesman for Facebook, apologized on Saturday.
“We fixed a technical issue that caused incorrect translations from Burmese to English on Facebook,” Mr. Stone said. “This should not have happened and we are taking steps to ensure it doesn’t happen again.”
Mr. Xi’s visit to Myanmar, the first by a Chinese leader in nearly two decades, was designed to celebrate Beijing’s expanding presence in the region.
During Mr. Xi’s two-day visit, the governments agreed to 33 projects designed to stitch the two countries closer together at a time when Myanmar is facing global criticism for its violent campaign against Rohingya Muslims.
The embassies of the People’s Republic of China and the Republic of the Union of Myanmar in the United States did not immediately respond to requests for comment on Saturday.
News of the vulgar translation appeared to be censored in China, where major news websites and social media platforms were silent about it. In China, citizens have been detained, and even convicted and imprisoned, for much milder derision of Mr. Xi.
When Facebook’s system finds a word that does not have a translation, it makes a guess and replaces it with a word with similar syllables, Mr. Stone said. After running tests, Facebook found that multiple Burmese words starting with “xi” and “shi” translated to the vulgarity in English.
U Po Myint, the chairman of the China Myanmar Friendship Association, said he thought that Facebook may have intentionally mistranslated Mr. Xi’s name because there are other more likely renderings of his given name in Burmese.
“But Facebook already apologized for their mistake so we can forgive,” Mr. Po Myint said.
Kenneth Wong, a Burmese language instructor at the University of California in Berkeley, Calif., also said that when he first saw the translation he thought someone intentionally made it to embarrass Mr. Xi.
But on closer inspection of the original Burmese post, Mr. Wong said, he could see how a machine would make that error. Mr. Xi’s name sounds similar to “chi kyin phyin,” which roughly translates to “feces hole buttocks” in Burmese, Mr. Wong said.
Greg Garvey, a professor of game design and development at Quinnipiac University in Hamden, Conn., said there were multiple explanations for how this might have occurred. When the translation system finds a word that doesn’t have a direct translation, it should put in a replacement word using the context of the rest of the sentence and data from millions of Facebook users.
Excluding malicious intent, Mr. Garvey said the vulgarity would have been used only if the system’s algorithm found it made sense based on Facebook’s trove of user data.
The exception, Mr. Garvey said, would be if there were words that corresponded in Burmese to the vulgarity — a happenstance that Mr. Wong and Facebook said did, in fact, occur.
Saw Nang contributed reporting from Mandalay, Myanmar.