Both companies are spending big on AI, but Google’s diversified business and cost discipline could help it pull ahead ...