A massive AI buildout and increasing competition highlight a changing landscape for the dominant software giant.