MS-DOS is Microsoft's command line Disk Operating System, originally bought and modified to run on the original IBM PC. It used a command line interface because affordable IBM PC-based home computers of that era were not capable of running a Graphical User Interface yet. The DOS command line interface came to define the stereotypical "hacker typing away on a keyboard" method of using computers in the 1980s.
Windows on top of DOS
DOS catapults Microsoft to the limelight
It can be said with a degree of certainty that the original deal Microsoft made with IBM, where MS-DOS was licensed to run on IBM's computers instead of sold outright to them, was the chief enabling factor in Microsoft's rise to its current status as the largest software vendor in the world. IBM's "great folly" with DOS was the assumption that "people pay for the hardware; no one makes money on software." IBM chose Microsoft over Gary Kildall's Digital Research Inc., the company which produced CP/M. CP/M was the most common third party command-line operating system available to that time, and served as the operating system for the previous generation of computers (such as some IMSAI machines)
In fact, IBM offered three OSs for the original PC — PC-DOS, CP/M-86 and the USCD P-system. CP/M had been the standard for 8-bit machines used in business and the P-system, a Pascal-based portable virtual machine, was fairly widespread in education and was used on the Apple II. Most expected those two to dominate the market in 16-bit systems; DOS was initially clearly the dark horse. One reason it won was that it had better license terms; IBM offered PC-DOS free on some systems and clone makers offered MS-DOS free.
There were other reasons, some complex controversies, and a range of rumours. CP/M-86 was (like many or even most large software projects) late and initially buggy; opinions on the details differ widely. One story  that became widespread was that CP/M-86 missed out on the IBM contract because Digital Research founder Gary Kidall missed a meeting because he did not come in from his yacht .
Seattle Computer were a hardware vendor with a CPU board based on the Intel 8086 using the S-100 bus. Naturally, they promised customers CP/M-86, the obvious OS for such systems. When that was late, they did their own QDOS, Quick and Dirty Operating System, in a few weeks just to give customers something while they waited for CP/M. Microsoft had been a major player in programming languages for 8-bit systems, but had never developed an OS; they bought QDOS and turned it into MS-DOS.
Kildall claimed that QDOS used parts of CP/M to speed development, that ironically Microsoft's market dominance was originally based on an act of the "piracy" that the company now so vocally abhors. Some recent analysis  rejects this claim.