There are several possible answers to your question.
If you mean why was methamphetamine chosen as a drug to be produced and marketed by illicit drug dealers, it is likely that the ease of manufacture (simple chemistry with readily available ingredients), potency (small amounts required for the desired effect) and consumer demand for such a drug were major determinants.
If you are referring to the discovery of methamphetamine as a chemical compound, it was discovered during the course of normal pharmaceutical research - the same kind of research that yielded the discovery of most synthetic compounds we use as medicines today.
I hope this answers your question.
EDIT: All of the above is true, but functions as secondary reasoning for the invention of meth. The real reason meth was invented: to give people from Nebraska something to do.