In quantum chromodynamics, the modern theory of the nuclear force, most of the mass of the proton and the neutron is explained by special relativity. The mass of the proton is about eighty times greater than the sum of the rest masses of the quarks that make it up, while the gluons have zero rest mass. The extra energy of the quarks and gluons in a region within a proton, as compared to the energy of the quarks and gluons in the QCD vacuum, accounts for over 98% of the mass.
The internal dynamics of the proton are complicated, because they are determined by the quarks exchanging gluons, and interacting with various vacuum condensates. Lattice QCD provides a way of calculating the mass of the proton directly from the theory to any accuracy, in principle. The most recent calculations[8][9] claim that the mass is determined to better than 4% accuracy, arguably accurate to 1% (see Figure S5 in Dürr et al.[9]). These claims are still controversial, because the calculations cannot yet be done with quarks as light as they are in the real world. This means that the predictions are found by a process of extrapolation, which can introduce systematic errors.[10] It is hard to tell whether these errors are controlled properly, because the quantities that are compared to experiment are the masses of the hadrons, which are known in advance.
These recent calculations are performed by massive supercomputers, and, as noted by Boffi and Pasquini: “a detailed description of the nucleon structure is still missing because ... long-distance behavior requires a nonperturbative and/or numerical treatment..." [11] More conceptual approaches to the structure of the proton are: the topological soliton approach originally due to Tony Skyrme and the more accurate AdS/QCD approach which extends it to include a string theory of gluons, various QCD inspired models like the bag model and the constituent quark model, which were popular in the 1980s, and the SVZ sum rules which allow for rough approximate mass calculations. These methods don't have the same accuracy as the more brute force lattice QCD methods, at least not yet.