What is the purpose of peer-review in journals?
It's a method to inform journal editors about the soundness of any arguments, their originality, and the correctness of any data used in the submitted work. This enables them to keep a good standard of published work (and helps the authors to improve their manuscript to achieve the required standard).

Thus, it serves as a quality control mechanism. Without it, editors would have to review on their own (which is still some form of peer-review, though not anonymized). This was standard in Einstein's days, but is completely impractical today for three reasons.


The sheer amount of submitted manuscript has grown substantially.
The scientific community is much more diverse with less overlap of personal areas of expertise, such that no single editor can judge more than a fraction of the manuscript they receive.
Allowing reviewers to stay anonymous avoids biases and provides a fairer process.


So, the editors' expertise must now be to find expert reviewers and to interpret their reviews appropriately (rather than being experts themselves as 100 years ago).

Admittedly, the mechanism does not work 100%, i.e. sometimes good work is rejected and sometimes poor work is accepted (depending also on the community and journal), but their appears to be no viable alternative.