Welcome new user, I will take a crack at explaining this. It is a good question and it's a very common misapprehension.
I think the shortest possible explanation is this:
You see how you said "... a top company such as Apple ..." ...
Forget 5 year. Here's a 25+ year chart of Apple:
It barely tripled in 20+ years. What an absolute dog!
Every day for some 25 years, people said "Apple is a 'good' 'top' 'best' company, simply invest in it to get rich." Many of those people literally died waiting for it to explode.
It's ironic that this question asserts "You need only invest in Apple to get rich!"
Apple is the prime example in 600 years of investing history where that idea flopped, with people waiting their whole lifetimes for it to pay off.
It can be difficult to grasp this (it's difficult for me, that's for sure!) but when we write a sentence such as "... a top company such as Apple ..." ...
... you are just saying: "a company which went up a lot the last few previous years".
It is "begging the question" in the biggest possible way.
From the question,
"You can even just google the top 10 companies in the S&P 500 and invest in them. The average gains from all of those companies .. [was big]
"The top 10 companies in the S&P 500" literally just means "the companies that gained the most the last few years!"
The two parts of the sentences are just: restating the same thing.
If you had used "your system" 5 or 10 years ago, it would not have been that same list.
TripleHound's pithy comment perfectly encapsulates the situation: just look at Pan-Am, Enron, Lehman Brothers.
(Recall that Apple stock was such a dog for so long, that at one point Steve Jobs, for goodness sake, dumped all his stock!)
Your basic trading idea ("invest in the currently biggest companies and hope they will grow") is as good as any other trading idea (ie: terrible! :) ) and it's been around a long time.
Back in the '70s folks would talk about the "Nifty Fifty" which was exactly the idea you're considering. Half the companies don't even exist any more. It's the classic standard tale of why "just invest in the currently biggest" doesn't work:
https://www.forbes.com/sites/investor/2019/05/24/are-any-of-the-nifty-50-stocks-still-nifty/#73b859441b17
(I.M.H.O. indeed the central mental goal of trading, on whatever time scale you do it, is to get away from the assumption that recent past performance indicates the future, you really have to completely let go of that mental state to trade.)
Thus,
"I am just curious at what I am missing..."
The answer is straightforward, you are making a severe logical error.
In the first three paragraphs you say "Companies A, B C have increased greatly in price the last X years. If you had invested in them X years ago, you would have made a lot of money."
Note that in making the list of A, B, C you refer to "good" companies, "major" companies and "top" companies.
But.
Good, major, top companies are literally just "those that have increased greatly in price" in the previous few years. Note the increased past tense.
If you could guess which companies are about to increase greatly in price in the next few years, you'd be the richest person in the galaxy.
Observe that in a few years from now, the companies that at that future time will be mentioned as good, major, top companies will be the ones that did, over our future, increase greatly in price.