Plants can’t run away when animals try to eat them so they produce chemicals to deter their enemies. Just like humans, plants also need to fight disease and make babies. So they produce chemical compounds to attract pollinators (birds, bees, butterflies and bats) and kill pathogens (bacteria and viruses).
These chemicals are biologically active in our bodies. Since time began, humans have used plants to heal themselves.