Like many in Virginia, Minn., Jim Pechonick works at an iron ore mine and was raised a Democrat. Then came Donald Trump with promises to restore the greatness of American steel.

“The only time in my life I’ve ever been out of a job was under Obama,” said Mr. Pechonick, 51 years old, recalling a stretch in 2009-10 when the mine closed due to the poor economy. In 2016, he joined a sizable number of union workers, particularly white men, who voted for Mr. Trump. “Somebody needed to shake up the country,” he said.

The shift helped Mr. Trump win Pennsylvania, Wisconsin and Michigan, states with strong union traditions, and has put Minnesota—which he lost narrowly three years ago—into possible contention in 2020. The president’s appeal to builders, electricians, plumbers, roofers and miners has alarmed labor leaders, who are now scrambling to prevent further erosion.

“It’s a serious problem for us,” said Alan Netland, president of the North East Area Labor Council in Duluth, Minn., which represents 40,000 union members. “People may say, ‘I voted Republican and the world didn’t fall in, so maybe I better keep doing that.’”

Union officials, along with Democratic presidential candidates, are now trying to highlight what they see as a yawning gap between the president’s pro-worker rhetoric and his policies.