Originally, when the X-Men were created (ie around 1962), 'Mutants' just were 'the super-people of the future, who were created by the Atomic Age'. Mutants were born anywhere, to ordinary humans.
A year or three later the Inhumans appeared in comics. They were an isolated, xenophobic society of super-people, created thousands of years ago by an alien race (The Kree), out of ancient humans. They were born looking like humans, but already possessing greater strength, intelligence and longevity; but when they were exposed to 'Terrigen', they would change into a super-powered form, which would however often look bizarre, even monstrous.
Now... ten years after that, you got the Eternals, and in that comic it was revealed humanity was created, from ape-men, by the titanic alien Celestials; they created the god-like Eternals, the diabolical Deviants and humans.
All of this came together in the pages of Thor, when the Eternals were brought into the Marvel universe proper, and it turned out the reason humans can get super-powers is because the Celestials put that potential there.
So, simply put: the Celestials created humanity out of apes, and humans can get superpowers spontaneously; such people are called 'Mutants', although they do not owe their powers to mutation.
Out of the same human stock, the Kree then created Inhumans, apparently by genetically engineering Deviant and Eternal genes into them.
Terrigen empowers Inhumans, but is toxic to humans and 'mutants'.