One of the manliest brands in men’s products has hit on an unusual strategy for divided times: questioning “toxic masculinity.”

Gillette, the Procter & Gamble Co. brand that for three decades has used the tagline, “The Best A Man Can Get,” is building a new campaign around the #MeToo movement, a risky approach that will be the latest test of how successfully big consumer brands can navigate tricky social movements.

The ad, created by the brand’s ad agency Grey and titled “We Believe,” opens with audio of news about the #MeToo movement, bullying and “toxic masculinity.” A narrator goes on to dispute the notion that “boys will be boys,” asking, “Is this the best a man can get? Is it? We can’t hide from it. It has been going on far too long. We can’t laugh it off, making the same old excuses.”

Watch the Ad

“This is an important conversation happening, and as a company that encourages men to be their best, we feel compelled to both address it and take action of our own,” said Pankaj Bhalla, Gillette brand director for North America, in an emailed statement. “We are taking a realistic look at what’s happening today, and aiming to inspire change by acknowledging that the old saying ‘Boys Will Be Boys’ is not an excuse.”

But in a sign of the risks Gillette is taking, the ad quickly provoked passionate rebukes online.

“The video is sad and depressing while putting ALL men in a bad light,” one Twitter user wrote. “Men aren’t just waking up to bad things that are going on. There have always been good men. Bad ones too, yes, but the same can be said about women.”

The new Gillette ad was meant to inspire positive behavior but spends too much time exposing the behavior that men have been criticized for, said Susan Cantor, chief executive of branding firm RedPeak. “Men are saying, we feel marginalized, criticized and accused rather than feeling inspired empowered and encouraged.”

P&G said it has no plans to pull the spot in the face of some negative reaction. “We recognize it’s sparking a lot of passionate dialogue—at the same time, it’s getting people to stop and think about what it means to be our best selves, which is the point of the spot,” Mr. Bhalla said.

P&G is among the companies that in recent years have used advertising as a platform to promote their stance on topics such as gender equality, immigration and gun control. The company is perhaps best known for its lauded “Like a Girl” ad campaign for feminine-care brand Always and “Stress Test” for deodorant brand Secret.

Newsletter Sign-up CMO Today CMO Today delivers the most important news of the day for media and marketing professionals. PREVIEW

But brands diving into charged social issues risk turning off customers who don’t agree with their stance, don’t believe it is authentic or consider it poorly handled. Last year, many Twitter users slammed Dodge Ram Trucks for using audio of a Martin Luther King Jr. speech in a Super Bowl ad for its Ram pickup truck that promoted public service, seeing it as a sales stunt.

Dodge has said it was celebrating Dr. King’s words and had the approval of his estate.

The new Gillette ad is risky, said Dean Crutchfield, CEO of branding firm Crutchfield + Partners. It “creates a credible, believable, and upfront conversation that takes brutal honesty and tough decisions,” he said.

As a result, it could appeal to millennials who care about what companies stand for, he said. “There’s a demand for this, for purpose, for brands to be tackling tough issues in the moment.”

But the ad could backfire and alienate Gillette’s base, Mr. Crutchfield cautioned. “Does the customer want to be told they’re a naughty boy? Are you asking too much of your consumer to be having this conversation with them?”

Nike Inc.’s ad campaign featuring former NFL quarterback Colin Kaepernick, who had led player protests for racial justice during pregame national anthem ceremonies, generated both praise and boycott threats when it debuted last September.

Nike appeared to weather any backlash from the effort, which was part of the 30th anniversary of the footwear giant’s “Just Do It” campaign. The company last month reported sales rose 10% in the latest quarter, driven by growth in both shoes and apparel. Nike Finance Chief Andrew Campion said in a conference call with analysts that the campaign “reignited brand heat in North America.”

The Gillette ad takes a different approach, according to Ms. Cantor. “The difference between this ad and Nike’s controversial ad is that Nike is saying, ‘Believe in something even if it means sacrificing everything,’” Ms. Cantor said. “It’s an endorsement of conviction, but not telling you what to believe. They weren’t explicitly supporting a certain behavior or admonishing a certain behavior.”

While misfires could hurt brand reputations in the short term, they don’t usually have long-term effects.

A 2017 commercial in which Kendall Jenner joins a protest march and hands a Pepsi to a cop was accused of trivializing the Black Lives Matter movement. PepsiCo Inc. pulled the ad from its official YouTube channel and stopped running it on TV. “Pepsi was trying to project a global message of unity, peace and understanding,” a PepsiCo spokesman said then. “Clearly we missed the mark, and we apologize.”

But the ad didn’t have an evident impact on sales. In subsequent quarters, PepsiCo blamed sluggish demand for its sodas in North America on the company’s focus on healthier drinks. The company’s soda sales have improved in recent quarters after the company ramped up advertising and returned more shelf space to its sodas.

In October, P&G reported its strongest quarterly sales gains in five years, snapping a stretch of lackluster growth during which the maker of products from Pampers diapers to Crest toothpaste has struggled to adapt to rising competition, higher costs and a consumer shift toward smaller brands. Sales in the grooming business that includes Gillette rose 10% in the U.S.

But Gillette has been losing market share to online upstarts like Dollar Shave Club and other smaller brands. To compete, Gillette has been cutting prices and coming up with new ways to attract customers, such as personalized 3-D printed razor handles.

—Aisha Al-Muslim contributed to this article.

Write to Alexandra Bruell at alexandra.bruell@wsj.com