Why does TTL work with 5V, when there's no 5V battery?
The simple reason is that back in the Dark Ages (like the 1950's and 1960's) nobody in their right mind would try to power logic with batteries. The first logic families, RTL, DTL, and the big winner, TTL, were bipolar, not CMOS. Currents were in the vicinity of 2 - 20 mA / gate, depending on interconnection. So any reasonable sized logic circuit would pull amps of current, and systems pulling 100's of amps were not unheard of. Not only that, the only widely available rechargeable battery chemistries were lead-acid and NiCad. Neither of these was going to provide 10's to hundreds of amp-hours of capacity in anything portable. 

With the widespread acceptance of TTL, the successor CMOS families (74HC, HCT, ACT, etc ad nauseum) were designed to be compatible with TTL, which meant 5 volt operation (although you'll notice that 74HC works over 3 - 6 volts). The big exception was the CD4000 series, which had (and have) a much wider operating range. Then, as fab processes got smaller and the devices faster, lower-voltage families started to dominate until, as KGregory points out, 5V is really not much used commercially, at least for entirely new designs. 

As for the origins of 5V/TTL, that was a set of design tradeoffs. If you find a schematic of a TTL gate, you'll notice that it needs at least 3 diode drops internally, plus various resistor drops. What that doesn't tell you is the choice of reference currents (1.6 mA for a low input) which was in part determined by the current levels required to produce acceptable switching speeds. These current levels in turn set limits on the internal resistor values, and the voltages needed to feed them. You also need to factor in the state of semiconductor fab capability - the first TTL circuits were at the edge of what could be reliably produced. Imagine - 20 to 100 gates on a chip! That's (gulp) hundreds of transistors, with the masks all laid out by hand.  All of this, including power dissipation limits, resulted in the standard TTL supply voltage spec of 4.75 to 5.25 volts. As it turned out, this was an adequately wide margin for practical systems, and the speed (10 - 20 MHz) was adequate for a wide range of applications. So TTL became king. Even then, if you wanted faster speed there were other families available, like 74S and ECL, but those puppies were even bigger power hogs than TTL. Go look up the construction techniques for the first Cray computers.