Here's the first issue for the foreign-born parent of a U.S. citizen child who hopes to immigrate based on that relationship: If the parent's permitted time on a visa runs out, and the parent waits in the U.S. with no lawful immigration status, the parent risks being caught by U.S. immigration authorities, placed into removal proceedings, and eventually deported home.
Some nonimmigrant visas come with the possibility of extensions, at least. (See How Long Will Your U.S. Visa Allow You to Stay?.) Student visas (category F-1) for example, can be stretched through multiple academic programs; perhaps an undergraduate degree, a master's degree, and a Ph.D.
Still, finding nonimmigrant visas that will stretch for 21 years is a challenge. That's especially true in a circumstance where U.S. immigration authorities might believe the person is looking for a way to stay in the United States permanently, which could bar eligibility for a nonimmigrant (temporary) visa or immigration status.
Returning to our above example, if the foreign-student mother of a new U.S. citizen who has an F-1 visa graduates, she might be able to find a legal way to spend more lawful time in the U.S. by other means, such as on a temporary, nonimmigrant work visa. Various visa categories allow people to request a "change of status" without leaving the United States. (People who entered on the Visa Waiver Program or VWP, however, can neither extend nor change their status; they must leave the United States at the end of their 90-day permitted stay.)
But if the mother's current immigration status runs out (or if we're talking about someone with no immigration status at all, for example who entered without inspection), the only lawful choice is to return to the home country to apply for the next visa. People who have fallen out of status or "overstayed" in the U.S. cannot, in most cases, change or adjust their status (that is, apply for a new or different right to be in the U.S.) without first leaving the country. The application would have to be made through a U.S. consulate in their home country. And that creates another problem.
People who have spent more than 180 days in the U.S. in "unlawful presence" and who then leave will not be allowed to return for three years. Those who have more than one year of unlawful presence then leave will not be allowed to return for ten years. "Unlawful presence" is a special concept in immigration law—for details, see Consequences of Unlawful Presence in the U.S.—Three– and Ten-Year Time Bars.
Now let's say the foreign-born parent is unable to stretch her legal stay long enough for the child to turn 21, and is arrested by Immigration and Customs Enforcement (ICE), placed into removal proceedings in immigration court, and ordered deported. Deportation always comes with a legal restriction mandating that the person not return for several years. The exact number of years depends on the legal grounds for removal. See How Long After Deportation Must I Wait Before Returning to the U.S.?
Let's imagine for a minute that the foreign-born mother stays unlawfully in the U.S. until the child turns 21 without getting caught. Although normally, would-be immigrants cannot apply to adjust status based on a family member if they're not already in the U.S. in legal status, there's an exception for immediate relatives of U.S. citizens who entered the U.S. legally (with inspection, probably with a visa). The parent of a U.S. citizen is an immediate relative, and would be allowed to "adjust status" to permanent resident based on that family relationship without leaving the United States—thus curing the unlawful presence problem.
But again, it means facing a long, not to mention possibly illegal, wait in the U.S. to get to that point, waiting for the child to turn 21.
There's another potential complication you should know about if a U.S. citizen child wants to petition for the foreign-born parent to receive a U.S. green card. The U.S. petitioner (the child) will need to also qualify as a financial sponsor. To do that, they need to be both living in the U.S. and earning enough to support the immigrant, themself, and any other dependents, at 125% of the U.S. poverty-line level (as shown on USCIS Form I-864p). This can be a major hurdle for a young person, though family assets can help. For more on this , see articles about The U.S. Sponsor's Financial Responsibilities.
As you can see, U.S. immigration matters are highly complicated. In fact, if you're reading this and your situation is similar to what's described, you should see an experienced immigration attorney for a full analysis. The attorney can also help you strategize the best way to apply for the green card and help you prepare the paperwork.