In an ordinary flush toilet
, in the water tank behind the commode
, the ballcock is the large, buoyant ball that floats and regulates the amount of water refilling the tank
As it floats up, it presses on the water valve through a lever system, slowing down and eventually stopping the water. When the tank is empty/flushed, the ballcock sinks to the bottom, and opens the water valve. I suggest you open your tank and take a look.