Microsoft had slowly moved their way into the video game business. The PC had become a popular gaming platform by 1995, and Microsoft made a commitment to building a first-class video game platform/SDK, DirectX.
Microsoft eventually decided to basically build a PC dedicated to gaming (XBox) that would leverage the legion of game developers already building on PCs. They also would be able to compete against Sony and Playstation because their platform was arguably easier to develop for and more well-known.
Microsoft was slowly moving onto consoles even before the Xbox. The Dreamcast ran Windows CE, and Microsoft approached SEGA at one point about building a Dreamcast 2, IIRC.
Microsoft eventually decided to basically build a PC dedicated to gaming (XBox) that would leverage the legion of game developers already building on PCs. They also would be able to compete against Sony and Playstation because their platform was arguably easier to develop for and more well-known.