Microorganisms and plants have been evolving for millions of years and along the way they've evolved to produce a range of substances that are able to do all sorts of things including killing pathogens
Instead of having to develop all of our drugs from scratch we've been able to take these substances from them and either use them directly as medicines or sometimes modify them in a lab of it first and then use them as medicines
Peer review, where the drug testing is analyzed by other scientists, is central to all of science and helps to prevent false claims or results from getting published