Fundamentally, immigration is a market response. Demand for labor inside of a country exceeds supply -- or, more accurately, the demand for labor in the receiving country exceeds the demand in the sending country.

This trade in labor is good for all the same reasons that any other trade is good: the commodity (labor) goes for the best price to the supplier to those who will most benefit from it, as indicated by their being willing to pay the most. Both parties benefit, it's a clear win-win, no problem. Right?

It gets a little more complicated in the case of immigration, for a bunch of reasons. Firstly: are the suppliers and sellers in this transaction nations, or individuals? You can look at it both ways:

If the parties in the trade are nations, then the benefit is rather lopsided to the receiving country: they get a new, productive worker, and any money they give that worker is mostly spent inside the receiving country, boosting that economy further. The sending country gets nothing -- even though it spent money educating that worker, providing them with healthcare, etc.. In practice, however, many immigrants send money back to family in their home country, a substantial flow of money known as remittances.

If the parties in the trade are individuals, the win-win nature is also obvious: the company gets a worker that they would otherwise have been unable to afford, the worker gets a better-paying job than they would have got in their home country.

But there's a third way of looking at it, and this is where things get tricky.

I could also have phrased the above as "for cheaper than a local worker". In practice, that's not usually how it works. Hiring an immigrant is generally more expensive and inconvenient than a native -- if a company could find a native worker to do the same work for the same price, they would rationally do so. However, the ability to hire immigrant workers at that price does prevent the company from raising the price it's willing to pay.

More simply: while the company wins, and the immigrant wins, a third party worker in the receiving country has, in one sense, lost: they could have got the job if they were willing to work for the same price as the immigrant, but not if they wanted more.

Immigration holds down labor prices, and this is where the trouble starts, because the connection between lower labor prices and greater prosperity for all is indirect and poorly understood.

When labor is cheaper, the goods those workers make can be sold for less (and, in a competitive market, will be). This means anybody buying those products is directly better off -- immigration has saved them money. They will then take that money and spend it on other things, and those sellers will spend it again on yet more things, until eventually somebody gets around to buying the goods being made by the third-party worker. He sells more of those goods, and so makes more money than before.

So any individual third-party worker is worse off because of immigration -- instead, everybody in the country shares a little bit of the benefit, and the total value created is greater than if the immigrant had never arrived, because there are two workers instead of one.

Resistance to immigration is, fundamentally, an acknowledgement of the selfish impulse to be personally better off, rather than making the whole nation richer. That makes it a big good economically, and a tough sell politically.