Non-Resident vs. Resident Alien Status
In the United States, "alien" is the term used within the immigration laws to refer to a citizen of another country. However, the terms "resident alien" and "non-resident alien" are actually terms from the federal tax laws. Resident aliens owe tax on all their income, while non-resident alien owe tax only on income generated from U.S. sources.
As you become better acquainted with these definitions, you'll realize that, contrary to popular myth, you don't need to have a green card in order to owe taxes to the U.S. government.
There are two tests for whether someone is classified as a resident alien:
1) The green card test. This applies to someone who has U.S. permanent or conditional residence, or a green card. The person is a citizen of another country, who is authorized to live and work in the U.S. on a permanent basis (or, in the case of a conditional resident, for two years that may then be continued into a permanent stay). By the very nature of the requirements placed upon permanent residents, they spend most of their time living in the United States. To keep a green card, you must not make your primary home in another country, nor remain outside the US for more than one year. (People who plan to remain outside the United States for more than one year can, however, apply for a re-entry permit before leaving, in order to preserve their green card.)
2) The substantial presence test. Even without having a green card, a person who spends 31 days in the United States during the current year and 183 days during a three-year period that includes the current year and the two years immediately before that, is considered a resident alien. This affects many people who are in the U.S. on temporary, otherwise known as nonimmigrant visas. There are various exemptions, such as for time people spent in transit (less than 24 hours in the U.S.), time during which the person couldn't leave because he or she required medical treatment, as well as for teachers and students (on an F, J, M, or Q visa) who haven't stayed in the U.S. beyond a certain period of time.
If you are spending some time in the U.S., but do not meet (or are exempt from) either the green card or the substantial presence tests, then you are most likely a non-resident alien. Students and teachers are often classified as non-resident aliens in the early years of their U.S. stay.
For more details on these definitions, see IRS Publication 519, U.S. Tax Guide for Aliens.
If you are a resident alien, your U.S. tax obligations are much the same as those of a U.S. citizen. You must report all your worldwide income to the IRS, even if you remain outside the United States for an entire year.
If you're a non-resident alien, your tax obligation to the U.S. government is reduced. You'll even use a different tax form than the regular 1040, and be taxed at different rates than resident aliens and citizens. You'll owe tax only on income that was generated within the U.S, not including any capital gains. And you might also be able to take advantage of some international treaty exemptions.