President Biden says he wants to save the planet and save union jobs. The electric-vehicle tax credit in his social spending package shows how those aims can sometimes conflict.

The proposal being negotiated by House and Senate Democrats gives consumers the full $12,500 tax write-off only if they buy electric vehicles assembled by union workers using American-built batteries. Automobiles produced in nonunion factories would qualify for $4,500 less.

Michigan Democrats Rep. Dan Kildee and Sen. Debbie Stabenow wrote the electric-vehicle tax credit after collaborating with the United Auto Workers and General Motors Co. about the importance of including an explicitly pro-union component, according to Mr. Kildee.

The labor-friendly provision has touched off a fierce lobbying battle by Tesla Inc., Toyota Motor Corp. , and other nonunion auto companies that say Mr. Biden is betraying the environment to help a political ally, the United Auto Workers.

“Biden is a UAW…puppet,” Tesla Chief Executive Elon Musk wrote on Twitter, replying to a tweet about the EV tax credits. Tesla, the world’s biggest electric-car maker, didn’t respond to a request for comment.

Biden’s bipartisan infrastructure bill includes specific references to bolstering the U.S.’s EV charging networks. That has led to a group of auto makers dramatically boosting their 2030 EV sales predictions, even though the bill hasn’t been signed yet. WSJ’s George Downs takes a look at what that could mean for your drive. Illustration: George Downs

Mr. Biden visited a GM electric-vehicle assembly plant Wednesday in Detroit and toured the newly renovated factory with GM Chief Executive Mary Barra. He also briefly drove around a parking area in the GMC Hummer electric pickup truck, which is set to go on sale in coming weeks at a base price of around $100,000.

“We’re going to make sure the jobs of the future end up here in Michigan and not halfway around the world,” he said.

The infrastructure bill Mr. Biden signed into law this month includes $7.5 billion to expand the network of electric-vehicle charging stations.