© Joseph Griffins

As the movements of vast swaths of the global population are restricted due to the coronavirus pandemic, those who test the limits of quarantines and social distancing are drawing a fierce backlash online.

An employee in Beijing of German pharmaceutical giant Bayer AG lost her job after she was heckled by an online mob for going outside her home to run in defiance of government orders. An Ohio man on spring break in Miami has become the subject of a tsunami of social media vitriol for insisting the coronavirus wouldn’t stop him from partying. And in the Philippines, police got help from Facebook users as they tracked down a man who escaped from quarantine.

Virtual vigilantes are using the internet to name and shame people they believe are putting others at risk by reckless leisure travel, unnecessary socializing and violating rules of quarantine. On Twitter, people have posted photos of groups drinking at bars in the U.S. and Hong Kong, lambasting them for irresponsible behavior.

Get fresh news and exclusive analysis on politics, policy, national security, regulation and more, delivered right to your inbox

Bing COVID-19 tracker: Latest numbers by country and state

“It’s part of efforts to pressure other people to do the ‘right’ thing and assert moral authority,” said Lauren Rosewarne, a social scientist at the University of Melbourne, Australia. “Public shaming of people has occurred throughout history. The internet simply enables people to do this with a broader reach and bigger audience.”

Brady Sluder learned this lesson the hard way after a CBS video interview of him on his spring break in Miami went viral on Twitter.

“If I get corona, I get corona,” said Mr. Sluder in the video, his face flushed and wearing a cap backward. “At the end of the day, I’m not going to let it stop me from partying.”

The groundswell of anger reacting to the video led to Mr. Sluder apologizing on his Instagram account on Sunday. “Our generation may feel invincible,” he said in the post, “…but we have a responsibility to listen and follow the recommendations of our communities.” Mr. Sluder didn’t respond to messages seeking comment.

Reactions to behavior seen as reckless have been particularly vicious in China, where the virus has infected more than 81,000 people and claimed over 3,000 lives. With recent numbers of daily new domestic infections close to zero, many Chinese worry the country will face another wave because of residents traveling overseas and bringing the virus back. Online harassment is particularly severe, with lawbreakers doxed—a practice in which the target’s personal details are exposed online.

A Bayer staffer who had just returned to Beijing from Australia became a target when she ignored government quarantine orders and went for a run. Videos of the woman in workout gear, jogging without a mask and defying the calls of a neighborhood watchman, garnered more than 20 million views on social media in China, where more than half a billion citizens have been under some kind of lockdown.

Netizens hunted down and publicized her identity and employer. Within two days of the viral video circulating, Bayer said in a statement on March 17 it had fired the runner. The woman couldn’t be reached for comment.

In the U.S., where the number of confirmed cases has surpassed 100,000 and more than half of states are under various levels of lockdown, some individuals, bars and organizations that have tried to carry on as usual have become targets of online ire.

Josh Albrektson, a South Pasadena, Calif., resident was incensed to see an Irish bar downtown host a St. Patrick’s Day party on March 17, a day after the city declared all dine-in restaurants and entertainment venues had to close.

The Irish pub—Griffins of Kinsale—blasted music from a live band from its storefront and dozens of customers mingled. Mr. Albrektson whipped out his phone, shot a video of the scene and posted it on Twitter, tagging city police.

“In this case, it’s life and death,” said the 41-year-old radiologist. “The 20 percent who aren’t listening [to government health advice] are risking the lives of the 80 percent that do.”

Upset residents took to social media to criticize Griffins, and its Yelp page was bombarded with so many scathing reviews that the website disabled new posts. County health authorities later shut down the bar.

Joseph Griffins, the owner of the pub, said he meant no harm and that new restrictions were coming in so quickly he couldn’t keep up. When the video was taken, the restaurant and pub had been open only for takeout, and some customers were waiting inside for their food, he said.

Mr. Griffins said he was surprised at the online backlash. “The internet has become a real tool—anybody is vulnerable,” he said in an interview. “There is a lot of slander, misunderstanding and misinformation. People say what they want to say.”

The anxiety people feel during the pandemic is fueling such online behavior, said Albert Fox Cahn, a fellow at NYU Law’s Engelberg Center on Innovation Law & Policy. “People feel powerless to fix the situation,” he said. “It’s a recipe for disaster.”

Romeo Baleros, a police director in the Philippines asked his thousands of Facebook followers for tips on the whereabouts of Felix Alejo, who had run away from mandatory isolation earlier that afternoon. Within an hour of the post, he received information about Mr. Alejo’s location and a photo of the escapee, both of which proved critical to catching the rule-breaker less than four hours after he had fled, the 55-year-old Filipino policeman in the province of Negros Occidental said.

“They tipped off for the sake of public health,” Mr. Baleros said. “If he was carrying a deadly virus, it would rapidly spread throughout the province, so people became vigilant.”

Privacy experts warn that such tactics can have consequences, such as misidentification. Doxing, in particular, could lead to retaliation, aggression or depression.

Fergus Hicks, a staffer with Swiss bank UBS Group AG in London was a victim of misidentification and doxing simultaneously. His picture, name and an erroneous job title were circulated on social media in Hong Kong, along with an unverified report from an internet news site called Fortune Insight that said he had been taken away by the city’s police for lying about his travel history and shirking quarantine orders.

Mr. Hicks, who is currently in London, said in an email to The Wall Street Journal that the report was false and the online publication had apologized. Fortune Insight posted a correction on its website. The publication didn’t respond to an email seeking comment.

Write to Liza Lin at Liza.Lin@wsj.com