Tech giant Microsoft (MSFT +1.50%) has been an excellent stock to own over the years.

In the past decade, it has risen by around 660%, which translates into a compounded annual growth rate of more than 22% -- that's more than double the S&P 500's long-run average of 10%.

That's what makes the stock's struggles this year all the more noticeable.

Since the beginning of the year, Microsoft's stock has fallen by 18%.

That's a big sell-off for what's traditionally been a safe tech stock to own.

What's behind this decline, and could it be the start of an even bigger crash ahead for Microsoft, or could this be a great time to add it to your portfolio? Is artificial intelligence (AI) to blame? Microsoft is down big this year, even in relation to other tech giants.

The Roundhill Magnificent Seven ETF has declined at a more modest rate of 7%.

The market as a whole has been bearish on tech stocks of late, with heavy AI spending a big reason for that.

But in Microsoft's case, the sell-off goes deeper than that.