Why is the mass of a Hydrogen atom lower than the sum of masses its parts?

Mass in special relativity is just energy, as measured in the center of momentum frame. So to determine how massive something is relative to something else, you can just consider how much work it takes to go from one arrangement to another.

If you have a large box with photons in it, it takes energy to make it smaller, since the photons exert pressure on the walls of the box as you push them in. Hence, a small box with photons in it has more energy and thus is more massive than a larger box with the same photon content.

On the other hand, protons and electrons are attracted to one another, so it takes energy to separate them. Thus, a system with a proton and electron separated has more energy and thus more mass than a hydrogen atom.

Let's start with re-hashing the underlying physical processes. You may know that a photon can "knock" an electron out of an orbit around a nucleus, producing a free electron and an ionized atom or molecule. Like almost all quantum processes this can be time-reversed: An electron is "captured" by an ion, neutralizing it, and in the process the energy difference is emitted as a photon. This is what you are interested in. This paper says

Recombination of free electrons with atomic or molecular ions is a fundamental quantum process of general interest to various fields of science. [...] Recombination into single atomic centers is known to proceed in three different ways: (i) The electron can be captured into a bound atomic state upon photo- emission. This process, which represents the time-inverse of photo-ionization, is referred to as radiative recombination.

[Emphasis by me.] Some energy has left the ion-electron system in the form of a photon. Since energy and mass are actually equivalent, the corresponding mass $m=E/c^2$ has left the system as well.2 Of course this is an event which has some finite probability per time unit under certain conditions; it may or may not happen. (And if it happened, it may be reversed yet again! And re-reversed! And re-{2..n}-reversed!) If we put a free electron and an ion in your impermeable, perfectly reflective box we cannot predict when they will combine; in fact, like Schrödinger's cat, the state of the box from the outside is a hybrid of both possibilities (with an increasing bias towards recombination, if that's the more stable state). You are right: Since nothing leaves the box we cannot know whether the particles have recombined, and consequently the system must have the same mass all along.

But note that the produced photon (or rather, the possibility of it) is still inside the box, hence part of that system; since it represents exactly the energy which is now missing in the recombined atom, the overall mass/energy in the box has not changed. If we accelerate it, we need to accelerate the photon with it. The overall system has the same inertia as it had before. If we open the box and let the photon escape its inertia will be smaller by exactly this quantum, which is unsurprising.

In general, we can say the following:

  1. Regardless of any possible events inside: An ideal closed system will not change any property which can be measured from the outside.1 This is in fact a more elaborate way of saying "it's closed": If something happened inside, and as a result we took note of a change on the outside, we would have some sort of communication, some interaction, between the inside and the outside. That is expressly forbidden.

  2. By contrast, any interaction of a system with its environment changes the system's properties exactly according to the interaction.

Neither sentence is overly surprising, but together they solve most questions revolving around "closed systems".

1 Which is mostly its mass, if I'm not mistaken, since the "closed system" does neither emit nor absorb radiation and must be in a perfect vacuum. As an aside, I suspect that this concept is inherently bogus. You cannot measure an object's mass without interacting with it, e.g. accelerating it. This interaction likely leaks energy (gravitational "Bremsstrahlung", http://adsabs.harvard.edu/full/1978ApJ...224...62K) or may reveal tidal forces inside the system. I'm also not sure how to contain gravitational waves from *inside* that box (which will, in minuscule amounts, be constantly produced by masses like atoms moving and gravitationally interacting in it). As a thought experiment, what will happen if you put two orbiting black holes in there and wait for them to collide? There is no gravitational equivalent to a mirror; we cannot disrupt space time.

2 This may sound surprising because everybody knows that "the photon is a massless particle "(https://www.desy.de/user/projects/Physics/Relativity/SR/light_mass.html); but, as the same article continues, it does have relativistic mass. The article actually then discusses "light in a box" much like your thought experiment.

As an electron and a proton approach one another, their electrostatic potential energy is lowered. this means the system of a hydrogen atom (electron bound to a proton) is a lower energy configuration than (free electron) + (free proton) and so the atom will weigh slightly less than its constituents. The missing mass shows up as an increase in the kinetic energy of the electron and the release of a photon and is equal to the (mass difference) x c^2.