The Earth is not an intelligent agent. The Earth doesn't "know" anything. Also, plenty of plants have evolved to be poisonous to prevent animals (including humans) from eating them, so you can't just blindly go around eating any mushroom or berry you find in nature. Natural does not always mean "good for you".