With artificial intelligence evolving at warp speed, betting on its future can feel both exciting and perilous.

AI’s impact on portfolios, the economy and everyday lives is getting bigger by the day. Mega-cap tech companies riding the boom make up some 36% of the S&P 500, with Nvidia Corp. accounting for almost 8%. The dollars flowing into the data center buildout are so huge they’re providing a significant boost to the US economy. Meanwhile, AI is reducing the number of entry-level jobs and sparking worries about the demand for electricity and water near data centers.