A battery holds charge chemically which means there is a barrier that separates positive and negative ions similar to a capacitor. Different batteries have different types of barriers and chemistry.
When the terminals of a battery are connected to each other (shorted,) the electrons flow to the other side through the wire making the voltage difference between the terminals to 0 same as a capacitor.
The time it takes to reach the 0 volt state depends on the maximum discharge current of the battery.
In theory, if you short circuit a voltage source the current would be infinite to maintain the same supply voltage. That is not possible in practice. When an actual power supply or a battery is shorted, very high current flows for very short time. Afterwards, if it is a battery then it would be fully discharged (probably damaged too,) or if it is some sort of power supply then the fuse would be popped, or the supply would be cut-off because of short-circuit protection, or some components in the supply would be blown because it couldn't handle the large current.