Back in the "dark ages" each microcomputer (as they were called before IBM introduced the PC) had its own operating system and software. Most of what would run on one computer would need major alterations made in order to get it to run on a different computer. Many, but not all, of the different computers used a version of CP / M as the operating system and most programs were written in BASIC which at the time was interpreted rather than compiled and most computer users knew about the technical aspects of their chosen system so (trans) porting programs from one system to a different one was possible, it just involved a lot of work.
Enter IBM in 1981 with the PC (with its 8088 processor). The entire system except for the BIOS chip was built using open technology that the other computer manufacturers had equal access to. As IBM was at the time the name in computers they effectively set the standard and most other computer manufacturers then tried to introduce computers that were compatible with the PC and hence could run the same software only on much cheaper hardware. All that they needed to do was to emulate the functions of IBM's proprietary BIOS chip. The various manufacturers had varying degrees of success at doing this but the most successful were deemed to be IBM compatible.
IBM continued to dominate the market through the 80s and produced the XT (8086 processor), AT (80286), but at around the time that they introduced the ET (80386) their competitors had gained the major portion of the market and IBM compatible came to mean that the system was compatible with the industry standard rather than compatible specifically with IBM. As the compatibles were built with standard BIOSes producing computers that were compatible with the standard became much easier than it was when IBM had control.
By this time most compatible software could be run on just about any system with sufficient memory to run it but that's not the end of the story with compatibility. Different computers have different brands of an assortment of devices attached each expecting its own particular method of communication with the rest of the system. Software writers needed to cater for the assortment of for example printers that could be attached to a system and a program like Wordperfect contained the code necessary to communicate in a different way with hundreds of different printers.
The introduction of Windows did away with this requirement of catering for all possible hardware from each individual program. (This more than the graphical interface was the real benefit to be gained from this product). Instead of having to access the hardware directly a program could call surfaces built into Windows which would do the access for the program. So instead of each program having to be able to communicate with all possible hardware, Windows took over this task. To make the job easier, Windows defined a standard way that it expected to communicate with the hardware and small modules called "drivers" were introduced to translate between Windows language and hardware language. Now the production of the drivers could be done by the hardware manufacturers who are most familiar with the way that their hardware works.
Today, most hardware has drivers available to allow it to work with most versions of Windows. Also most software will run on any system that has sufficient memory to run it and which also also contains whatever types of components that the software uses. Games (which is now the area requiring the most computing power) typically specify the amount of memory, minimum processor speed, minimum CD-ROM speed (they usually run straight from the CD), and minimum 3D graphics card requirements. Usually if your system meets or exceeds these requirements then that game will run on your system but not always.
Given the vast range of different hardware that is available and the speed at which system capabilities are changing, not all of the combinations of hardware that can be built that meets the minimum requirements to run specific software is necessarily able to run that software. Sometimes there is a minor error in the way that the hardware works that only shows up when you try to run certain software and that software just wont work on that hardware. The hardware works fine for everything else so you can not really blame the hardware manufacturer for not discovering the problem. Also the software works fine on just about every other hardware configuration that meets the specified requirements so you can not blame the software writer for not discovering it either. It's just one of those things that gave the complexity of both the hardware and software markets. Installing the latest driver may fix the problem (if the manufacturer has found a fix) but that does not always work. Sometimes the only way to get some specific software to run is to change some of your hardware. The software may run quite happily once you switch to using a different graphics card (or you may need to make a different change depending on what problems you are having).
There are millions of different configured computers out there and millions of different programs available that will run on many of those computers. This is why a computer is different from the other appliances that you buy at the department store.