How can I figure out where the toilet overflow pipe goes?
The overflow pipe is for when the tank is full AND the normal fill-control system for the tank fails. If there is water entering the overflow pipe either due to a failed fill control setup or due to a leak in the connections at the bottom of the tank then that is a problem that should be fixed.

I would suggest adding some food coloring or similar dye into the tank. This should allow you to quickly determine if the water is coming from the tank or not.