If you're investing in up-and-coming growth stocks, you don't necessarily need to make a huge investment to generate massive returns later on. You can make up for that by investing for a long period. Two stocks that have provided investors with life-changing returns over the past 20 years are Nvidia (NVDA 3.01%) and Apple (AAPL 6.72%). Here's how much $5,000 invested in these stocks 20 years ago would be worth today.

Nvidia: $1.6 million

Nvidia was always a popular name in tech for its graphics cards, but over the past few years things have really taken off for the business. The rising implementation of artificial intelligence (AI) and the popularity of ChatGPT (and other generative AI applications) have created significant demand for the company's chips, with Nvidia looking to play a prominent role in AI's growth. There were approximately 10,000 chips used in the creation of ChatGPT, and with Nvidia dominating the market for AI chips (with close to an 80% share by some estimates), its business has flourished. Over the past three quarters, the company's revenue has jumped by 86% year over year to nearly $39 billion. Earnings, meanwhile, have skyrocketed from less than $3 billion to more than $17 billion.

According to analysts from Bank of America, as demand for AI services and chatbots rises in the future, Nvidia may be able to add another $14 billion in revenue to its top line by 2027. That's a significant chunk for a company that in fiscal 2023, which ended in January of last year, generated just under $27 billion in sales.

Since the start of 2004, Nvidia's stock has generated incredible returns for investors, with a $5,000 investment back then now being worth nearly $1.6 million. Given its high valuation today, it's unlikely that Nvidia can have a repeat performance over the next 20 years. But with much more growth ahead, it may still not be too late to invest into one of the market's best AI stocks.

Apple: $2.4 million

Apple was in trouble in the 90s, and was close to bankruptcy in 1997. Its rival, Microsoft, provided the business with a much-needed lifeline, investing $150 million into the computer company at the time.

Since then, things have gone a lot better for Apple. A big part of the reason is the iPhone. While Apple's Mac computers are popular today, it was the launch of the iPhone that really transformed the business and which made it an exciting, innovative company to invest in. Over the years, the company has launched iPads and other services, but its bread and butter remains the iPhone. It all links back to there.

With close to 1.5 billion active iPhone users in the world, Apple has a strong customer base it can upsell products and services to. And even though the newest iPhone iterations may not offer groundbreaking new technologies, many of its most devout customers still crave the latest and greatest iPhone.

In the company's most recent fiscal year (ended Sept. 30, 2023), Apple did more than $200 billion in iPhone sales, which was down only 2% from a year ago, even despite inflation and rising interest rates. In a true testament to the company's versatility and strong brand, the business' top product still did fairly well given some challenging economic conditions.

Apple's business still has room to grow, particularly in services, where subscriptions can help provide it with recurring revenue that it can build on over time as it gives its users more of a reason to go deeper into its ecosystem. From music to streaming to news, there are plenty of services that can help give Apple's top line more of a boost in the future.

Its near-$3-trillion valuation can make Apple's business seem expensive, but with a loyal customer base, and a large one at that, this too can still be a good investment to hold in your portfolio for the long haul.