In the U.S., the general rule is that income is taxable where the activity or transaction occurs. All compensation for services performed in the U.S. is subject to federal taxes unless an exception applies.
The services you perform in the U.S. will be taxed based on your residency status for federal income tax purposes. Whether you are considered a resident alien or non-resident alien for tax purposes determines how you are taxed. (These are tax terms, not immigration terms.)
The U.S. tax system is pay-as-you go. There may be automatic tax withholdings from your paycheck, stipend or financial aid, meaning that in some cases your income will be reduced by the amount of the tax withholdings.