For a long time everything was thought to be made up of protons, neutrons and elections. It was finally discovered that protons and neutrons are made up of more elementary particles called quarks. (electrons are still considered an elementary particle). It was noticed that adding up the weights of the individual quarks created a weight that was less than the weight of the protons and neutrons. One of the aspects of the Theory of Relativity is that the mass of an object gets larger as it approaches the speed of light. Quarks in a particle are moving so fast that their mass is actually larger when in a proton or neutron and that explains the mass difference.
(The Great Courses – Science in the Twentieth Century)