Because new arrivals inject new money into the local economy. A new arrival buys products, pays for services etc. Their foreign dollars often also go further - meaning they can inject more vs a local, who - by nature of the problem - can't hence the need.
You could argue a tax break for locals would do the same thing, but it's not quite the same, as locals paying less tax may tend to choose saving any extra cash rather than change their spend-habits. Foreigners are bringing new money with existing habits.
It's the Danegeld, why should we want to attract those people?
Both the governments and the companies are counting on the underlings to stay put.
While it is harder to switch country than it is to switch employer, the optimal strategy for the citizen/employee is the same in both cases: Hop to the better deal as soon as there is one available - show no loyalty, you'll never get any in return.
Also, I'm not sure they're actually effective overall. For every tax break you give to a new arrival earning say over 100k, there's surely an existing resident earning the equivalent whom you are effectively encouraging to leave with such a discriminatory policy.
And indeed, according to headlines like this "As Digital Nomads Flock to Lisbon, Portugal’s Youth Are Leaving in Droves"[1], it seems to be playing out this way.
Like the annoying business practice of offering steep discounts for new customers, it relies on the inertia of your existing customer base (in this case citizens). The problem is that the "digital nomads" you are trying to attract are the least "sticky" type of resident (after tourists) and are far less likely to fully engage is civil society and contribute at that level (often never bothering to even speak the local language). While if you drive one of your own citizens to relocated in another EU country, the net loss is greater.
Having lived and worked in Dublin for a long period, I was interested when a Dutch-style seven year rule was proposed by the government a few years ago. There was immediate, widespread vocal opposition and the proposal was dropped quickly.
[1] https://www.bloomberg.com/news/features/2023-10-28/companies...