GELSENKIRCHEN, Germany—For 20 years, Stefan Diete, a lab chemist at an oil refinery in this western Germany town, was a member of a far-left party with Communist roots. In this month’s election, he said he would vote for the far-right AfD.

“There are places here, it’s not Germany any more. It’s not even Europe. It’s the Middle East or Africa,” said the athletic, heavily tattooed 58-year old. “I haven’t read the AfD’s economic program and I don’t care. I’ll still vote for them, because of immigration.”

Polls show the AfD, short for Alternative for Germany, could more than double its score at the coming election and deliver its best national performance since its creation 12 years ago, driven by frustration about Germany’s economic slump , immigration and crime . A few pollsters think it could even win the election, but even if it finishes second, its rise will be felt as an earthquake in a country that has strived for decades to keep the far right out of government.

Behind this ascendance is a broadening in the AfD’s support base. Recent voting and survey data show it is rapidly gaining ground among blue-collar workers and even some migrant communities in Germany’s struggling industrial hinterland—places that were long seen as fortresses of the left.

People like Diete could help the AfD expand from its traditional strongholds in the former East Germany, home to just a fifth of German voters. Mirroring the rise of the MAGA movement that helped Donald Trump win the popular vote last year, this shift could determine whether the anti-immigration group can become a truly national force with a claim to governing Germany.

Located in the northern Ruhr region, Germany’s equivalent of the U.S. Rust Belt, Gelsenkirchen is among the most economically depressed cities in Germany. As a mining town, it grew rapidly during the late 19th and early 20th century. In World War II, more than half of all homes and a third of its industrial capacity were destroyed by Allied bombardments. Heavy industry and textiles helped it rebound after the war, but it declined rapidly following the oil shocks of the 1970s and a failed conversion into a solar-energy hub.

At 12.7%, Gelsenkirchen’s unemployment rate was double the national average last December and the highest of any German city of its size, according to the Federal Labor Agency. Of Germany’s 400 municipalities, it had the second-lowest purchasing power and the second-worst economic performance, according to studies published last year by the German Economic Institute, a business-funded think tank.

On a recent morning, its high street was tidy but drab, lined with boarded-up kebab shops, discount drugstores and a vast but closed branch of the Irish Primark budget-fashion chain.

At last year’s European election, the most recent nationwide ballot, the AfD scored 21.7% of the votes here, one of its best showings in western Germany and well above its national average.

The city and its surrounding region would be a major prize. With its web of midsize towns, the Ruhr is Germany’s densest urban area, and the European Union’s fifth largest. The state of North Rhine-Westphalia, where Gelsenkirchen is located, is home to 18.2 million people, more than the entire east including Berlin, and almost a quarter of all German voters.

Of the various nationalist, antiestablishment parties now ascendant in Europe, the AfD is among the more radical . It wants Germany to leave the EU and lift sanctions on Russia. It has criticized the country’s culture of Holocaust remembrance and some of its regional chapters are classified as far-right extremist organizations by the German domestic-intelligence agency.

Its rise has drawn particular attention in Germany because the country’s constitution was designed to avoid the instability and extremism of the Weimar years, which led to Hitler’s takeover of power. The fact that lawmakers from the AfD and the center-right Christian Democratic Union voted jointly for the first time to adopt a symbolic anti-immigration motion last week prompted hundreds of thousands to protest.

Despite this, the party is expanding its voter base, as evidenced on a recent windy morning in Buer, a district north of the city center.

On a busy pedestrian street there, Friedhelm Rikowski, the party’s local candidate for parliament, and his team had set up bar tables clad in AfD-blue and were handing out lighters, beer openers, brochures and fake deutsche marks—the former German currency that the party wants to reintroduce to replace the euro.

Jolanthe Zylka, a cheerful 63-year-old former nurse, moved with her ethnically German parents from Poland to Gelsenkirchen 41 years ago and once supported the Animal Protection Party, a single-issue group. Now, she said she is “attracted to the AfD because they say what I think. What’s going on here is no longer normal. I don’t let my house wide open for everyone to come in.”

The AfD is benefiting from rising unemployment, immigration and crime in parts of west Germany, said Stefan Marschall, professor of political science at Heinrich-Heine University in Düsseldorf, an hour’s drive south of Gelsenkirchen. But he cautions that it will struggle to match its support in the east because traditional parties are far more deeply anchored in the west, whose many affluent regions haven’t warmed to the AfD’s populist message.

Still, the party has been gaining support among all socio-economic and age groups over time, said Roland Abold, head of pollster Infratest dimap, and particularly among young and blue-collar voters. At last year’s European election, 33% of voters who describe themselves as blue-collar supported the AfD, more than any other party, according to the pollster.

Western towns where the AfD has made recent breakthroughs include places such as Salzgitter, a former steelmaking center; Pforzheim, an old watchmaking town in the south; and Pirmasens, once a leather-industry hub. While not all as economically depressed as Gelsenkirchen, they are all old industrial towns, said Matthias Moehl, a data analyst at Election.de, an electoral analysis website.

“These are the Ohios and the West-Virginias of Germany,” said Moehl. “These are where the good jobs used to be and no longer necessarily are.”

They also tend to be medium-size and relatively isolated from the bigger, more politically centrist urban centers. Unlike the east and some rural districts where the party has been strong for a while, they have big migrant communities.

When industry began shedding jobs in Gelsenkirchen 25 years ago, people started to leave. Rents fell, which in turn drew refugees and Eastern-European migrants, said Udo Gerlach, a local politican for the center-left Social Democratic Party. Migrants now make up almost 40% of the city’s population. Immigration, he said, was the main reason his party has been losing support after dominating local politics for decades.

“We get a lot of abuse sometimes when we’re out campaigning,” said Gerlach, who worked at the refinery for 35 years and saw colleagues gradually abandon their SPD memberships. “The people who gravitate toward the AfD, they’re not Nazis. They’re just dissatisfied.”

Enxhi Seli-Zacharias, who leads the AfD in the city, said her party is even gaining support among the city’s oldest migrant communities, including German Turks, whose parents and grandparents came in the 1960s, who are often assimilated and don’t always look kindly to more recent arrivals from Arab countries and the Balkans.

“I had to integrate in this culture,” said Seli-Zacharias, who was born in Tirana, Albania, and moved to Germany with her parents at age 7. “I know what I had to do to get my passport and it drives me crazy to see how these are being handed out to people with no cultural connection to Germany whatsoever.”

Back at the AfD information stand in Buer, Ali Bahadir, a 51-year-old German of Turkish descent who is setting up an old-age nursing business, stopped by for a chat and a brochure.

“I’m curious about the AfD. My kids don’t like them, but I want to read what they have to say,” he said. “I can’t just rely on the media. It’s not independent. It criticizes the AfD but never Israel or the Jews.”

Minutes earlier, a young Turkish-German man had approached Jan-Hendrik Preuss, a teacher who chairs the AfD group in the town council. The man had a question: Like his brother, he was considering supporting the party but wanted to know whether it would stop Muslims from going to the mosque and ban halal food.

“Not at all,” said Preuss. “You don’t need to worry about that.”

Write to Bertrand Benoit at bertrand.benoit@wsj.com

Corrections & Amplifications undefined Germany’s snap federal election will be held in late February. An earlier version of this article incorrectly said it would take place next month. (Corrected on Feb. 4)