Just how big could generative artificial intelligence (AI) be? Many experts are trying to answer that question. And global consulting firm McKinsey & Company thinks it has an answer.

McKinsey recently released a report on generative AI that projects the technology could produce economic benefits of up to $4.4 trillion. The firm estimates that just three industries could account for roughly $1.2 trillion of that total. 

Investors should have tremendous opportunities to profit, based on these predictions. Here are the three industries that could be among the biggest winners from generative AI, along with the top stock to buy in each one.

Banking: Bank of America

McKinsey estimates that generative AI could impact the banking industry by up to $340 billion. The firm thinks the technology will help banks in several ways, including:

  • Migrating legacy software code to new platforms
  • Providing "deep technical support" to customers
  • Personalizing sales and marketing content for clients
  • Scanning for missing documentation in contracts
  • Reviewing regulatory updates and alerting appropriate staff of any changes

Major banks are already spending money to incorporate generative AI into their processes. I think that Bank of America (BAC -0.21%) arguably ranks as the best pick for long-term investors in the group.

Bank of America is widely viewed as a technology leader in the banking industry. For example, Fortune named BofA as one of the most innovative companies in the U.S. BofA won the American Financial Technology Award for "Best AI/Machine Learning Initiative" for its Sherlock AI tool. Global Finance named the company as the most innovative bank in North America.

The stock is also available at a steep discount right now, largely as a result of the banking crisis that began earlier this year. Bank of America shares trade at a little over eight times forward earnings. 

High tech: Microsoft

Unsurprisingly, McKinsey expects that generative AI will greatly benefit the high-tech industry. According to the consulting firm, the total impact could be as high as $460 billion. In particular, McKinsey thinks that generative AI could help high-tech companies develop software more rapidly and efficiently.

Microsoft (MSFT 1.82%) has already been a big high-tech winner in this year's AI surge. Its stock has soared close to 40%, boosted by its partnership with ChatGPT creator OpenAI.

Microsoft should also benefit in a major way over the long run from its own internal deployment of generative AI. The tech giant could significantly cut software development time using its AI-powered tools.

Generative AI isn't the only reason to buy Microsoft stock, though. The company has plenty of other growth drivers, including its cloud platform and gaming business.

Retail: Walmart

Retail should be another industry where generative AI makes a big splash. McKinsey projects that the financial impact on the retail industry could be as high as $390 billion.

The consulting firm anticipates that generative AI will help retailers in multiple ways, such as: 

  • Accelerating consumer research
  • Assisting employees in supporting customers
  • Speeding up the creation of advertising and marketing content
  • Developing strategies for negotiating with suppliers

Amazon will benefit greatly from generative AI in its non-retail businesses (especially its Amazon Web Services cloud unit). But Walmart (WMT -0.08%) could be the retail stock best positioned to profit from using generative AI in these ways. 

Walmart has already incorporated AI into its operations. Many of its distribution centers use fully autonomous vehicles. The company uses AI extensively in managing its supply chain.

It's important to keep in mind that Walmart ranks as the largest nongovernment employer in the world. The larger a company's staff, the more generative AI could potentially help achieve efficiencies.

While generative AI is potentially a long-term reason to buy Walmart stock, there's also a short-term consideration. If the U.S. economy enters a recession, as many economists predict, shoppers will almost certainly look even harder for bargains. Walmart stands out as one of the more recession-proof stocks on the market.