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.
There are some requirements to gain US citizenship but the major rule is:
*Have resided continuously in the United States, having been lawfully admitted for permanent residence, for five years immediately preceding the date you filed your application for naturalization.