SHANGHAI—Frustrated investors in China are howling about recent stock market losses on the social-media accounts of foreign embassies, in one case turning a greeting by U.S. Ambassador Terry Branstad for the coming Year of the Dog into a platform to protest.

Messages posted by the U.S. Embassy to its official account on the Chinese social-media service Weibo have attracted thousands of stock-related comments in recent days. Posts included items about the Winter Olympics and a video Lunar New Year greeting from Mr. Branstad...