A belief in a better tomorrow and exhilarating sky-high returns are two of the many reasons Tesla (TSLA 12.06%) embodies every stock investor's dream. It's a decade-long story of what it means to truly win in the stock market by sticking with a company through the ups and downs.

But there's another story: the story of the rise and fall of oil giants like ExxonMobil (XOM 0.02%), Royal Dutch Shell (RDS.A) (RDS.B), and BP (BP 0.13%). Last week, Tesla stock passed $2,000 a share for the first time in its history, making Tesla worth more than those three oil giants combined.

Tesla is rising and oil stocks are falling, but here's why you may not want to buy Tesla right now. 

A white Tesla Model S cruising by a snowy mountain.

Image source: Tesla.

The ephemeral king

For the first decade of the 21st century, oil stocks helped make people rich. Strong oil demand and limited supply caused oil prices to quadruple in eight years, leading oil stocks to dominate the list of the most valuable companies by market capitalization. At the helm was ExxonMobil, which reached a peak market cap of over $525 billion on Oct. 18, 2007. If you invested in Exxon at the beginning of 1995 and held it for 13 years, the share price appreciation and dividends would have increased your investment 762%.

Many technology giants like Microsoft began the 21st century with market caps comparable to the oil majors, but the oil majors soon pulled away.

XLE Chart

Energy vs. Technology Sector Performance, data by YCharts.

For the first 10 years of the 21st century, an investment in energy would have more than doubled your money, whereas an investment in tech would have cut it in half and then some. 

But then, the world changed, and tech giants began competing with ExxonMobil for the title of the most valuable company. Although there was a time when buying oil stocks would have made you rich, you would have been much better off owning technology stocks over the past 10 years.

XLE Chart

Energy vs. Technology Sector Performance, data by YCharts.

Today, technology comprises over a quarter of the S&P 500, whereas energy makes up just 3%. 

Let there be light

But what about Tesla? You may be questioning how Tesla could be worth more than some of the world's biggest oil companies combined, when it posted its first annual profit in January of this year. It all has to do with future expectations and where investors think a company is going.

Many investors believe that Tesla's best days are still ahead. Its first-mover advantage in the electric vehicle space has proved invaluable. Although it took a few very turbulent years to work out the kinks of producing its cars at scale, Tesla is now the undisputed market leader in an industry that could surpass internal combustion engine cars over time.

For this reason, investors are willing to pay a big premium for Tesla stock, believing that Tesla will continue to grow revenue and earnings for years to come. So, although Tesla doesn't make a lot of money right now, the widespread conviction that it will be extremely profitable later on is why investors keep making money on Tesla stock.

Aside from wanting to make money, many people want to invest in companies that they truly believe are creating a better tomorrow. This type of investing is called environmental, social, and governance (ESG) investing. For folks who believe electric vehicles are one answer to a brighter future, investing in an ESG stock like Tesla is a way to make investing fulfilling and profitable.

From oil to energy

By contrast, many people believe that the best days for oil and gas have passed. And for the first time ever, many oil and gas companies agree with that statement.

Shell CEO Ben van Beurden noted during the company's first-quarter earnings call that even he doesn't know if oil demand will ever return to its pre-pandemic levels.

On Aug. 4, BP made it clear that it doesn't even want to be an oil company anymore, posting a press release titled "From International Oil Company to Integrated Energy Company." In that release, BP said it would cut its oil production by 40% by 2030 and increase its annual low carbon investment by 1,000% between now and 2030. 

Meanwhile, ExxonMobil has dug in its heels, showing little interest in investing in renewables. It continues its mission to be the best oil and gas company in the world.

The dangers of valuation

It may not be a good idea to invest in Tesla right now for the same reason investing in ExxonMobil in 2007 wasn't a good idea: valuation. Exxon could dominate when oil was king and it was the king of oil.

Right now, Tesla seems like it can do no wrong, benefiting from competition that hasn't caught up and a seemingly endless runway of possibilities. But Tesla has a lot to prove, and its increased stock price has taken away a lot of upside. Near a $400 billion valuation, it's hard to see Tesla going up from here.

Contrarian ESG investing

Oil's best days may be behind it, but I disagree that Tesla should be valued more than Exxon, Shell, and BP combined. And with many oil majors now embracing renewables, a few oil giants could turn into renewable energy stocks. Investing in an oil giant that is trying to get away from oil could be a contrarian way to approach ESG investing.

In the meantime, Exxon, BP, and Shell all yield over 4% and are on sale for 40% off their prices at the beginning of the year. Tesla is an amazing growth story, but at today's prices, I'd go with a downtrodden oil major that wants to be a diversified energy company or an elite oil stock.