The origin of mass in subatomic particles, such as protons, neutrons, and electrons, is attributed to the interaction with the Higgs field. According to the Standard Model of particle physics, the Higgs field permeates all of space. Subatomic particles interact with this field, acquiring mass as a result.
The Higgs field is associated with a particle called the Higgs boson, which was discovered at the Large Hadron Collider (LHC) in 2012. The Higgs boson is an excitation of the Higgs field. When subatomic particles interact with the Higgs field, they experience a drag-like effect, analogous to moving through a medium. This interaction slows down the particles, giving them mass.
In other words, the Higgs field acts as a sort of "cosmic molasses" that particles move through, and their interaction with this field is what gives them mass. Particles that interact more strongly with the Higgs field acquire more mass, while particles that interact weakly or not at all have less or no mass.
It is important to note that the Higgs mechanism and the Higgs field are part of the currently accepted theory known as the Standard Model, but there are ongoing efforts in physics to explore and understand the fundamental nature of mass more comprehensively through theories such as supersymmetry and quantum gravity.