Micosoft said it is making a multiyear, multibillion-dollar investment in OpenAI, substantially bolstering its relationship with the startup behind ChatGPT chatbot as the software giant looks to expand the use of artificial intelligence in its products.