In a nutshell, miasma theory argued that illness was transmitted through the air, which could be poisoned by emissions from rotting organic matter. If you breathed this poisoned air, the theory said, you got sick. "Bad" air could be distinguished from "good" air by its offensive odor -- the stronger the odor, the worse the miasma. The way you prevented disease was by removing things that smelled bad to somewhere people weren't.
The miasma theory fell short compared to germ theory in several respects. While germs can be transmitted through air, for instance, they can also be transmitted through water, physical contact, etc. -- so miasma theory was spectacularly unhelpful in dealing with diseases like cholera, which is transmitted through water. There are also lots of situations where germs can be present even though there's no obvious bad smell, so miasma theory is no help there. Germ theory can explain why a doctor who doesn't sanitize his instruments between operations can pass an infection from one patient to another, for example; miasma theory cannot. And since it identifies the germ as the underlying vehicle of transmission, germ theory provides a means of protection -- kill the germ and you prevent the transmission. Miasma theory had no explanation for what exactly in the supposed miasma was causing the transmission, so its prophylactic utility was limited.
It's one of those things where people very early on made an intuitive observation (that being in places full of things that smelled bad tended to make people sick), and since that observation was "good enough" to make it useful in a lot of cases, it became part of the conventional wisdom. But once the scientific approach started finally being applied to medicine, its limitations became clear.