Founded in 1976 by Steve Jobs, Steve Wozniak and Ronald Wayne, Apple Inc. (AAPL  ) holds the largest market capitalization today at $3.021 trillion.

Google, founded in 1988 by Larry Page and Sergey Brin, two Ph.D. students at Stanford University, now operates as Alphabet Inc. (GOOG  ) (GOOGL  ) with a market cap of $1.722 trillion.

Despite the companies' different business models - Apple as a hardware giant and Google/Alphabet as a search and advertising giant - their history reveals a complex relationship. In 2001, Google's co-founders considered Jobs as their CEO, but after the iPhone launch and Google's acquisition of Android, tensions arose.

At Apple's 2010 town meeting, Jobs famously said, "We did not enter the search business. They entered the phone business. Make no mistake, they want to kill the iPhone. We won't let them. This 'don't be evil' mantra is bullshit."

While Google is the default search engine on Apple products, recent reports suggest Apple receives substantial payments for maintaining this status.

Both companies compete in various sectors, including mobile phones, applications, and services, such as mapping apps, app stores, music services, and cloud storage.

But which stock would have given you better returns had you invested money at the end of last year? The answer may surprise you.

As per the first graph, Apple's price a year ago was $129.21 per share and rose to $189.37 at the end of last month. Conversely, Google's share price was $88.23 a year ago and spiked to $134.99 in the same period.

If you had invested $1,000 in Apple stock on Dec. 30, 2022, today you would have had $1465.62 by Nov. 30 this year.

On the other hand, if an investor had put $1,000 in Google on the same day, they'd have been left with $1,529.98 by the end of last month.

Why Has Cupertino Lagged Google's Gains?

Google's diversified revenue stream, particularly from search and ads, contributed to its outperformance over Apple, which heavily relies on hardware sales.

Apple faced challenges such as supply chain disruptions, soft demand, and market competition, leading to a fourth consecutive quarter of year-over-year revenue decline in September 2023.

Its main iPhone assembler Hon Hai Precision Manufacturing Co. Ltd. (HNHPF  ), aka Foxconn, shut down its main plant in China in October 2022. The tech giant also faced a setback in China, its key market this year, as domestic competitors such as Huawei and Xiaomi Corp. (XIACF  ) began to offer compelling offerings.

In contrast, Alphabet benefited from a recovery in ad spending and reported higher third-quarter revenues primarily from search and YouTube ads.

Analysts are more optimistic about Alphabet's future, with a mean price target suggesting a 14.47% upside compared to Apple's 5.29% downside. While Apple may rebound if consumers strengthen, Alphabet faces regulatory risks, including an antitrust lawsuit. If the company loses the legal battle, it might impact its search business. Its AI opportunity could, however, prove to be a strong revenue driver for the company.