Why are they voting against their own (theoretical) economic
Nobody votes logically. The expectation that we are rational agents who behave in such a way is demonstrably false.
In his 2011 book, 'Thinking, Fast and Slow', Daniel Kahneman explains behavioural economics, and why people make irrational decisions. Part of his assessment makes the distinction between 'econs' and 'humans'.
Econs are the rational ideal of how humans ought to be, as presumed by classical economics and other older beliefs about human agency. However, nobody in the real world is an econ. The closest to them are psychopaths and economists. The vast majority of humans behave in irrational ways, guided by many intuitive cognitive biases.
There are related phenomena worth considering: most importantly Loss Aversion and incomplete information. The latter is obvious; those with less money tend to have less education, and thus know less about the outside world and history, and consequently are less able to judge that some egalitarian policies would benefit them, and are thus more vulnerable to political Red Herrings. It's hard to keep abreast of political history if you're working round the clock to put food on the table or keep the heating on.
Loss Aversion is simple: people avoid loss more than they seek gain, because losses are more painful than gains are pleasurable. But it's also that the likelihood of risk taking is changed by how the question is framed.
While this explains that most wealthy people will vote for stability to avoid risking loss, it also implies that the working class have a revolutionary tendency, because they have nothing to lose in voting for radical change. They also tend to have little to gain from the stability of the status quo.
In comparison, comfortably middle class liberals have much to gain from something they can be reasonably expected to achieve, such as home ownership or university education. But if you can't afford either, why would you vote for it? Especially if the cost to you is real but the benefit is at best indirect (and mostly non-existent).
It shouldn't be a surprise then that it's easy to frame immigration and taxes as a painful loss to someone who hasn't much to lose. Potentially positive changes, such as free university or a new healthcare system, are distant abstracts, versus immediate concrete negatives such as higher taxes.
Richard Wilkinson and Kate Pickett's 2009 book The Spirit Level explored the relationship between social dysfunction and economic inequality, and part of this inquiry considered the impact of status anxiety. The more impoverished the individual, the more aware they are of their status, and also the more anxious they feel about it.
This means that loss aversion combined with status anxiety is an explosive combination, especially when loaded by any status dimensions of prejudice. The prospect of equalisation with groups deemed lesser ("they've just come to this country, I have been here my whole life and paid taxes", etc), for the lower ranked members of a dominant group, invokes nothing but loss aversion and status anxiety.
A final point to add is an observation made by Stanley Hoffmann, who was a professor of political science at Harvard University. Hoffmann spent his teenage years hiding from the Gestapo in a French village, and later classified collaborators into different groups. He noted that those who volunteered with the Germans were mostly from opposite ends of French society: the elite ("the cream of the top of the civil service, of the armed forces, of the business community"), and the underclass ("social misfits and political deviants" who'd never have amounted to anything).
Hoffmann's point was essentially that this group is threatened by the prospect of an egalitarian or entrepreneurial system, as they cannot gain status when they are forced to compete. Consequently, underclass ally with upperclass to form a reactionary vanguard, and gain status through loyalty.
This however can also be said of Communism. It's a point Anne Applebaum has made (Twilight of Democracy) in her analysis of the history of Communism, that the emergence of a modern far-right falls into the same pattern: loyalty to dogmas is easy and can be used by one group to benefit themselves at the expense of others politically. The difference is just that western societies are no longer agrarian, like the Russian Empire before Communism. Consequently, revolutionary politics tends right, not left, because more people own something and thus loss aversion plays into political fears and choices. But the process and mentality is similar.