COPENHAGEN — It was the sort of campaign appearance that Mette Frederiksen, leader of the left-leaning Social Democrats, would have ordinarily considered friendly terrain — a gathering of environmentally minded students in her hometown, Aalborg, in Denmark. Except the students demanded whether Ms. Frederiksen knew the carbon footprint of the red roses her party gave away at campaign stops.

She didn’t. And the students — who also criticized her climate policy for failing to mention the Paris accord — didn’t let her forget it.

“We want action. Something must happen,” said Mathilde Christiansen, a senior.

In the maelstrom of European politics, Denmark is usually fairly quiet, routinely ranking among the world’s happiest, wealthiest and most egalitarian nations. But the national elections scheduled for Wednesday have shaken the country from any complacency, as two very different issues are roiling the political landscape: climate change and immigration.

In recent elections, the right-wing Danish People’s Party has won power by taking a hard line on immigration and pushing tough policies on asylum seekers. The Social Democrats have taken a pummeling, and Ms. Frederiksen has moved her party to the right on immigration in an attempt to win back working-class voters — even as she is trying to keep up with the green wave influencing the younger electorate.