The second law of thermodynamics states that "in all energy exchanges, if no energy enters or leaves the system, the potential energy of the state will always be less than that of the initial state." In its prediction of a constant decrease in potential energy, it does not refer to energy loss (or energy gain) due to to interaction with external systems. So, for instance, a dead battery that is recharged is not in violation of the second law, since the energy used to recharge it was input from another system.
The concept that the second law describes is called entropy. Entropy is a measurement of the chaos within a system. When a system is extremely chaotic, it has a high entropy, and when it is rigidly ordered, it has a low entropy. The second law states that the tendency of any system is to increase in entropy over time. Left to themselves, systems always move from order to chaos.
One useful example of entropy is a watch. When the watch is wound, potential energy is stored in the spring; as it unwinds, most of that energy is transformed into kinetic energy, moving the gears and hands of the watch. But some of the potential energy is transformed into heat, which dissipates, and as the watch winds down, all its mechanical energy is also eventually lost as heat. In real life, this heat escapes into the external world. But even were the watch the only thing in the universe, the thermal energy would be unrecoverable and bounce chaotically around the watch. Rigidly ordered potential mechanical energy---the wound spring---has thus gradually transformed into chaotic thermal energy, and the entropy of the system has increased.
An increasing level of entropy in every system in the universe means that it is the tendency of all energy, left undisturbed, to distribute itself evenly around a system. For example, placing an ice cube (a very cold thing) in a cup of tea (a very hot thing) eventually results in a cup of tea of a consistent, cooler temperature. The entropy of the system has increased, and thermal energy has spread out chaotically across the system. The same thing is going on all over the universe. Like a series of narrow rivers emptying into a very large, flat basin, the universe's energy is constantly flowing from concentrated low-entropy configurations into distributed high-entropy ones.
Theoretically, a constant increase in universal entropy could result in a state of maximum entropy, when all energy has distributed itself evenly and thus stops flowing. Because the natural flow of energy powers every device in the universe, including the cells of human bodies, this "heat death" would be an apocalyptic scenario, albeit one more placid than most. Following heat death, the universe would be nothing except a calm, silent zone of perfectly even temperature.