If your house has been on fire forever and is burned down to cinders and the fire department finally shows up you're not going to thank them. You're going to yell at them and tear them a new one. You're probably so mad that you're going to tear the hose out of the hydrant and scream "let it f'ing burn you !#$!#$!#"
The house has been on fire since the mid-1970s. The roof collapsed in 2008.
I think it might aid understanding to look only at the Republican primary. Jeb Bush was the favorite, and Trump destroyed him. Jeb like Hillary was seen as establishment, a relative of two former presidents who also had an opportunity to put out the fire but did nothing.
Hillary Clinton is a part of the establishment. Her husband is a former president who presided over a booming decade when these problems could have been fixed but weren't.
Trump rightly or wrongly was perceived as being an outsider hostile to that establishment. Personally I see him as an opportunistic con man who saw a chance and took it, but it doesn't matter. The chance was there to be taken.
Edit: continuing with the fire metaphor: the roof collapsed in 2008 at the tail end of the Bush II administration. Obama sort of noticed and walked up and peed on it. The pee sizzled and steamed for a second and the flames shot higher.