Two different equations in the sense that they're used for different scales.
mgh is used for objects with very small masses compared to that of the Earth (a car is massive, but not compared to a planet), which thus experience a gravitational acceleration of ~-9.8 m/s^2. The equation also uses "height", which is the same basically as distance from surface of the earth. m*g gives you the weight of the object, and h gives you the height it would be falling from if it were to fall straight down.
As for the gravitational potential energy equation, you obviously have G, which is a constant that is NOT the same as the g above. You take into account the masses of both objects (M and m) and the distance between their centers, not their surfaces. Yes, you could figure out the approximate distance between the center of a tennis ball 10 m above ground and that of the Earth, and run it through the equation, but your answer would be inaccurate cause the numbers are all way too big or small for each other. Like trying to measure the diameter of a cell with a yardstick.