I understand the general derivation of the shell theorem by feynman but I don't get why he denotes the potential energy with W, the symbol for work. I would understand this if they would be the same but the work done in taking a particle from infinity to earth should be positive (wether we provide the force or gravity provides the force) so why is it negative in this case? Thanks in advance. Here is the link to the webpage: feynmanlectures.caltech.edu/I_13.html
The gravitational force is attractive so the work done by an external force to bring the mass $m’$ from infinity to the shell (which is the change in the gravitational potential energy of mass $m’$) is negative as the direction of the external force $-\hat r$ is in the opposite direction of the displacement $+\hat r$.
This means that to reverse the process (positive) external work has to be done to move the mass $m’$ from the shell to infinity and the gravitational potential energy of the mass $m’$ increases.
Taking the zero of gravitational potential energy as when the mass $m’$ is at infinity moving it to the shell reduces its gravitational potential energy ie the gravitational potential of the mass $m’$ is negative.