There has been a lot of hype around artificial intelligence (AI) technology lately, thanks to the massive popularity gained by ChatGPT. This is a generative AI application that responds to users' queries and allows them to create content such as text, audio, video, images, and code.

ChatGPT's raging popularity has triggered a race among tech giants such as Microsoft, Alphabet, Amazon, and Meta Platforms, among others, which are looking to take advantage of this trend and are set to invest billions of dollars into AI in the coming years.

There are many ways that investors can take advantage of the money these companies will pour into AI in the long run, but buying shares of ASML Holding (ASML -1.03%) and Taiwan Semiconductor Manufacturing (TSM -0.34%), popularly known as TSMC, could turn out to be one of the safest ways to profit from this hot tech trend. 

Let's look at the reasons why each of these stocks stand out from the pack.

The semiconductor industry is poised to win big from AI

Allied Market Research estimates that the global AI chip market was worth $11.2 billion in 2021, but it's expected to grow to a whopping $263 billion by 2031. A potential catalyst of this scale should prove profitable for semiconductor companies like TSMC, as semiconductors are the building blocks for the proliferation of AI applications. Powerful and power-efficient chips will be required to train complex AI models, along with inferencing purposes so that the trained model can deliver predictions based on the real-time data that's fed into it.

This explains why investment banking and financial services provider Jefferies anticipates that AI will drive the need for more wafer capacity amid growing demand for graphics processing units (GPUs), central processing units (CPUs), and connectivity chips. As a result, Jefferies believes that foundries such as TSMC will need to accelerate the adoption of advanced chip manufacturing processes that will help them make more powerful chips while keeping a handle on power consumption.

The investment banking firm also adds that the personal computer (PC) and server markets have led to a 55% compound annual growth in TSMC's revenue over the past four years. AI is now going to join the mix and become a major growth driver for the company's top line. That's logical, considering that TSMC has been focused on making more chips based on advanced process nodes such as 5-nanometer (nm) and 3nm.

The Taiwanese giant got nearly a third of its revenue from selling 5nm chips to clients such as Nvidia and AMD in the fourth quarter of 2022, as their CPUs and GPUs were based on this process node. This year, TSMC is going to ramp up the production of 3nm chips, which are expected to witness solid demand in the coming years.

Jefferies estimates that TSMC's revenue could grow at a compound annual rate of 15% through 2025, thanks to the demand for its advanced chips. This makes it an ideal bet on the growth of the AI market, considering that it's trading at a trailing price-to-earnings (P/E) ratio of just 14.

AI development will boost demand for ASML's products

The advanced chips that TSMC and others will manufacture are made possible only by a process known as extreme ultraviolet (EUV) lithography, and ASML is the only company that sells these machines. The Dutch semiconductor giant's monopoly in EUV lithography explains why there's a long queue for its advanced chipmaking machines.

The company was sitting on a massive order backlog of 40 billion euros at the end of 2022, driven by roughly 31 billion euros worth of bookings it received during the year. The size of the backlog is more than sufficient to cover the 25% sales growth that ASML forecasts for 2023 to 26.5 billion euros. Additionally, with the EUV lithography machine market set to clock annual growth of 27% to 29% through 2026, ASML should continue witnessing solid growth in its orders. After all, chipmakers will continue to try and shrink the size of their chips to tackle AI workloads.

All this indicates that ASML should be able to achieve its impressive long-term growth target and live up to analysts' expectations for it to clock nearly 30% annual earnings growth for the next five years. As such, investors looking to make the most of the AI boom may want to buy ASML stock before it's too late. It currently sports a P/E ratio of 44, which is rich compared to the Nasdaq 100's multiple of 26.

However, ASML deserves this valuation. That's especially true given the terrific growth that it has delivered, its robust long-term outlook, and the key role it will play in the proliferation of artificial intelligence in the future.