system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why is water in fruits safe for consumption?

When I dig up the soil and drink water from it, I'm pretty sure that I'm going to be sick because of all the bacteria, pollutants and chemicals in this water. I can't drink tap water, river water, or even the rainwater where I live for this reason, too.

However, somehow when I take water from these sources and feed it to my plants, I can trust that the water I will consume later when I eat the fruits or leaves (in the case of vegetables) from these plants will be safe for me. Why is that?

I guess what I hope to know is: When plants take water from the underground, where do all the bacteria, pollutants and chemicals go? Are they filtered by the root and stem of the plant? Or are they "killed" by some kind of immune system that the plants have?

....................................

EDIT: Thank you everyone for answering. I did not expect so many replies, I think I understand this topic much more now. I used to think that water in fruit is always sterlized and completely safe to drink, but apparently that is not the case.

A lot of comments also asked where I live that I cannot even drink tap water straight from the faucet. It is my understanding that in Europe and North America, tap water is often safe to drink, but that is not the case at all in many developing countries. In fact, I remember being VERY surprised when I first saw American people drinking from fountains in parks or filling up a glass of water straight from the kitchen sink in Hollywood movies.

I live in Vietnam. The tap water here mostly comes from rivers, and it undergoes all the filtration and chemical treatment that we can give it, but we are still recommended to at least boil the water first before drinking.

When I was a kid, we did not even have a system to deliver tap water to every homes, even in the capital city (Hanoi). That was as recent as the early 2000s, (I was born in 1993), and most people used to drink and cook using either water from well or collected rainwater. But nowadays, many wells in my city are found to have lead, arsen and heavy metals in it, and rainwater is recently reported as unsafe to drink basically anywhere on Earth because it had "forever chemicals" in it that will never decomposes and can cause cancer. Tap water and bottled water are basically our only options, though the goverment still recommend boiling tap water or at least filter it one more time before drinking/cooking with it.
gpt
>Are they filtered by the root and stem of the plant? Or are they "killed" by some kind of immune system that the plants have?

Both.

Plants are highly efficient at filtration.  They are also really good at sequestering different substances in different parts of the plant.  They also have immune systems that protect against many kinds of disease threats.

Of course sometimes that can be a problem.  If plants sequesters all of the lead they take in from polluted soil into their roots, then if it's a root vegetable that could be a problem for you when you eat the root.  But with fruit, the plant is pretty much going to make sure it's as clean and uncontaminated as possible.