There are a myriad of reasons why the Editor rejects a manuscript with basis on reviewers' comments.The main reasons are related to conceptual problems and methodologcal problems. It is often the case that the manuscript is not sufficiently new, falls prey to plagiarism, is not in the scope of the journal, and do forth. As I see it, the peer-review system eliminates the worst and the best and publish the mediocre. If, for example, you challenge, say, a "sacred cow" in any domain of knowledge the probability of having your paper rejected increased a lot. Manuscripts are also rejected because of linguistic problems, references, lack of clarity ans parsimony, and so forth. Note also that the publish or perish policy is a cause of manucripts' rejections. As everyone wants to be published, journals receive a enormous quantity of paper and not all hem can be published.
In order to learn the "rules of the game" of scientific writing, young scientists must start reading articles early and writing. Nevertheless, they will learn faster by being themselves reviewers in some journals.
Reasons for manuscript rejections are mentioned in the rejection letter. Manuscripts are not all rejected for the same reasons, so one should correct the specific errors each time.