I wonder where those terms came from.
Is it computer science related?
Or are they related to civil engineering, or swimming sports?
Is it some analogy with filling water in a pool, or something like that?
Yes, Computer Science.
Back in the days of the NASA/Apollo program (and possibly before), mainframe computers had wads of memory (like as much as 256 Mwords). To support multi-tasking, a program/task running on that mainframe had to specify how much memory was required to do its job, and the system would allocate that much - if possible - out of the "memory pool". This "pool" nomenclature comes at a time when we had motor pools, secretarial pools, labor pools... nonspecific resources of a certain class; indeed, this working memory on a mainframe was not dedicated to a specific use (there are regions of mainframe memory that are not available to "normal" programs/tasks).
As the tasks run, they are supposed to only use what they ask for, and they are required to signal the system when the memory is no longer needed. Depending on efficiency concerns, they may ask for the memory a little at a time (it's nice for other tasks that you don't grab either everything available, or more than you need). Poorly developed programs have a nasty side-effect of not returning what was allocated to them. From the system's perspective, the available memory pool is getting smaller and smaller, hence the memory "leaks out". It doesn't go anywhere, but the net effect is that a program that needs a certain amount of memory to either load or run will have to wait until a better behaved program/task returns a sufficient part of the allocation - or the memory system is restarted.