I’m casually learning physics and have noticed that Newton’s law of gravitation and the electrostatic force formulas look similar. I’ve asked this question before but would really appreciate another response. Is it possible that the two laws are related? Can the law of gravitation be seen as the macroscopic averaging of Coulomb’s law? So atoms on average have negative charge (positive mass) and thus on a macroscopic scale we observe that two large bodies (eg planets) attract rather than repel. Would it help if we assume that masses can be positive as well as negative? Apologies as I’m not a physicist (rather a data analyst) and these are probably dumb questions.
those two laws look similar because they both describe the propagation of a long-range field through three-dimensional space which produces a force that acts (in the simplest example) between pairs of objects, and in which the strength of the resulting force depends on some extensive property of each (charge in one case, mass in the other). the long-range-force part in three dimensions furnishes the 1/r^2 part, the influence of the extensive property furnishes the product m1 x m2 or q1 x q2, and the constant term (G or E) contains the fundamental strength of the coupling.
However, if we are talking about coulomb's law and newtonian gravity, those different fields do not couple or mix- which means you can't "make" gravity out of electrostatics or electrostatics out of gravity. Furthermore, gravity is always attractive because there are no negative masses, whereas electrostatic forces can be either attractive or repulsive because charges come in either + or - form.
This is a simplistic explanation. Note that there are far deeper reasons rooted in the underlying mathematics for why these things are the way they are and I invite the professionals here to weigh in on this.
To the best of our knowledge they are not deeply related although there is a theory called Kaluza–Klein theory that tried to interpret electro-magnetism as curvature of space-time much like gravity. There are, however, no real indications that this is correct.
To get back to the original question the relation is that the force equation has identical functional form with just different constants. This can be interpreted as coincident but is useful in mechanics since you can reuse many results for gravity in the case of charges that interact.
They look similar because both describe "self-generated" forces which a) act at a distance, and b) are conservative. That is, they conserve energy and produce stable orbits.
You'll need to learn calculus to do it, but you can show that, for a force which varies with distance, a non-circular closed loop in the system ONLY produces a zero net energy if the exponent of the force with distance is -2.
In other words, if the two forces did not obey the inverse square law, the universe would either explode or implode, as energy is either created or disappears. Since neither of these things happens, we're stuck with the existing form of the laws.