Why homeless people, poor people, sex workers, those who committed crimes, habitual criminals and gay people were persecuted:
Homeless people, poor people, sex workers, and criminals were seen as burdens to society. Some Nazis believed their behaviour to be genetic.
Gay people wouldn't produce children and were therefore seen as worthless to society.