Water on a boat will use a complex system that you will need to learn about before spending extended time onboard. Here are a few key points about how (most) water systems work on boats:
Freshwater tanks will be placed in the deepest part of your boat – this is where you will put fresh, potable water to drink. This water will be used by your sinks and the shower, with the water accessible through a pump in this tank to send water where it needs to go.
Depending on the toilet onboard, you will either have a chemical toilet (which has everything needed as part of the toilet), or will use a seacock to allow water from the sea to come into the toilet. The seacock has a mesh filter to ensure nothing except water is drawn into the toilet via the pump.
Used grey water is usually filtered back out into the water around you (the water from the sinks or shower) so it’s important to be mindful of what you are putting down the drains and to use soaps that are safe and biodegradable for the marine life around you.
If you have a toilet onboard (and not a freestanding chemical toilet), this will be flushed into black water tanks onboard. You will need to have a pump out for water held in this tank to ensure you aren’t contaminating the water around you. Most jurisdictions will also allow you to flush the toilet directly into the water when you are located at a minimum of three nautical miles off the shoreline.