Back in 1920, the New Republic reported on an exercise in which students at a New England college were asked to provide definitions of the word "alien". Their answers were uniformly negative: "a person who is hostile to this country", "a person on the opposite side", "an enemy from a foreign land". ...This is a bit like complaining that the term "drug dealer" has negative connotations. A news broadcast would not ordinarily say that someone is "legal" because people are ordinarily assumed to be legal. A news story about "immigrants" would imply legal immigrants.
But "alien" still suggests strangeness and difference and people who are "not of our sort", a connotation that was strengthened when science-fiction writers picked the word up in the 1930s to refer to extraterrestrial beings. ...
And those who take a hard line on immigration almost never use "aliens" to describe foreigners who are in the country legally -- on news broadcasts, "illegal aliens" outnumbers "legal aliens" by about 100 to 1. Legally speaking, "alien" refers to any non-citizen, but in political debates it often suggests "brown people who snuck in", a way of denying undocumented arrivals the label "immigrant" that most Americans associate with their forebears.
As the article mentions, the term "undocumented" is incorrect for those who overstay a visa. The term "immigrant" is also incorrect for guest workers and others who do not intend to move to the USA permanently. The term "resident alien" is fairly common for foreigners with (legal) green card. I have yet to hear a better term than "illegal alien" for foreigners who come to the USA temporarily and contrary to law.