How many years does an immigrant have to live in the US to become a US citizen?
The general answer to this is that a person must live in the United States for five years before the person is eligible to become a US citizen. Please note that this is not technical legal advice, just a general answer.
I should say that a person must generally live five years in the US as a legal, permanent resident before being allowed to apply for citizenship. A permanent resident is what is usually referred to as the holder of a "green card."
There are various rules about how much of the five years a person can spend outside the US, but the idea is that the US must be your permanent home for five years before you can apply.