Let's start with the second part first. As you move an object further away from a body you increase the gravitational potential energy of that object. Where exactly you are going to consider it zero is a matter of convention. Since it can be proven that when the distance between the bodies goes to infinity, the gravitational potential energy has a limit, it is a common convention to set that limit to be the zero for the gravitational PE. Any distance closer than infinity will result in a lower PE and for something to be smaller than zero, it has to be negative.

The second force comes in play because you want to calculate only the PE. If we were considering only the gravitational force, the object would accelerate towards the mass M and will gain KE. To avoid having to deal with KE, we assume that a force equal in size and opposite in direction to the force of gravity is applied to it, making the net force acting on the object zero. That skips the fact that you need a tiny bit of acceleration to get the object moving from infinity towards the point P and a bit of acceleration to stop it when it gets there. Lucky for us, it can be proved that the work done by these two cancels and we can ignore them when doing the math for PE.