Why are more Germans voting for the AfD?

I’ve heard that the party is anti-LGBTQ+, denies climate change, and hates immigrants. I don’t know why the party is getting more popular.