As I recall, IBM hired Bill Gates to provide an operating system for their personal computers, the PS/1 systems. Microsoft delivered DOS (Gates bought it from some guy, it was not developed at Microsoft). DOS worked on Intel processors. PC clones then appeared and used DOS too. Years later Microsoft released Windows 95, which was a windowing system that worked on top of DOS.
With the PS/2 system, IBM tried to dominate the market with their Micro Channel architecture. It flopped because none of the manufactures of PC clones were willing to license the Micro Channel architecture from IBM. As a consequence IBM became a niche player in the PC market.
IBM's OS/2 was a great operating system and far superior to Microsoft's DOS. But it was expensive, and people were not willing to pay the higher price. PC clones were cheap. Superior technology does not always win in the market place. DOS on PC clones was cheap and was good enough for the average user. Consequently Microsoft won in the market place.
OS/2 was expensive because IBM was going for a different market.
The PS/1 was a downgraded line introduced after the PS/2, which came long after Gates sold DOS to IBM for the original PC.