<p>I would like to create a case or a box which has two holes for incoming and exiting water. I want the box to be opened and closed. Therefore it is good to be something like a treasure box.</p>
<p>Is there a way to design the lid of the box to prevent water from leaking around the areas where the box and the lid are meeting without using glue?</p>
<p><a href="https://i.stack.imgur.com/HYo0p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HYo0p.png" alt="enter image description here" /></a></p>

"Completely" is always relative, but for water at the pressures involved it's probably achievable. Normally you need some sort of
gasket
(material that can bend/compress to slight imperfections in the mating surfaces), and a means of holding the two surfaces tight against the gasket, to get such a seal.
With 3D printing, it's plausible that the print itself could be sufficiently non-rigid to achieve this, if you have a way of keeping the lid and box pressed tightly against each other - bolts through the lid, clips around the edges, etc. But it's unlikely to work well.
I would either print I suitable gasket in TPU, or cut one from some suitable material if you don't have the capability to print with TPU. Either way you still need to design your box and lid so that they're pressed tightly against the gasket.
One possible frame challenge would be doing a round box instead, with a circular threaded lid. It's likely that you could achieve a decent seal for your purposes without any gasket just by tightening the threads, and if not, you still have a really good setup for use with an added gasket.