Both gravity and electromagnetism obey inverse square law as a function of distance.
True, but their strength is a lot different; electromagnetism's strength decreases much more rapidly over distance than gravitation. Others have pointed out more reasons why it is highly unlikely that gravity is a product of electromagnetism. There just isn't a strong correlation, let alone a mechanism to connect such a correlation if it existed.
Gravity is always attractive. Electric forces can attract or repel. So, there's one difference right there.
Also, electric forces are produced by electric charge, whereas gravity is produced by mass. While there are apparently two types of charge, there's only one type of mass.
Finally, the strengths of the gravitational and electric forces are vastly different.
These are just three reasons why gravity can't be electromagnetism.
As James points out there are differences between gravity and electromagnetism, sufficient to support a position that they are not, at least directly related.
In almost all of these discussions I begin from a more classical view of both gravity and inertia and try to work forward. By classical I refer more to a practical perspective than a Newtonian view. How do things appear "in the world", and as a matter of experience? The problem is that this has not provided any progress toward even partial unification of GR and QM. Attempts to develop quantum gravity have had similar problems. At some point there must be some connection. Both gravitation and electromagnetism are required within the context of any fundamental description of the universe, as we have come to understand it.
Electromagnetism and quantum fields are fundamental aspects of more than just the electromagnetic nature of "atoms" and matter... And while James is again correct in that, "
gravity can't be electromagnetism", this is not the same as saying that what we experience as gravitation, does not emerge from the same underlying fundamental "subatomic" interactions.
Without presenting the following as a definitive or conclusive example, consider the potential that inertia is emergent from QM as an interaction between the motion of matter in space and the quantum fluctuations of virtual particles of 'vacuum energy', expressed through the DCE, Dynamical Casimir Effect. At least from an initially superficial view, this would be consistent with SR and the Lorentz Transformations and what we understand of inertial and relativistic mass. The DCE interaction between matter and 'vacuum energy' would be trivial at classical velocities and significant at relativistic velocities, to the point of representing an underlying mechanism for the limiting velocity, the speed of light in vacuum, $$c$$.
The similarity between inertia and gravity as expressed in the equivalence principal, though it does not provide a direct and obvious connection, between gravitation, and the DCE and QM, does suggest that one may exist.., just beyond current explanation.
Setting aside the issue of gravitation, the implications of a connection between the QM effects associated with the DCE and the motion of matter and inertia, does have some potentially significant implications for inertia and the recent FTL neutrino results from OPERA. While matter, an atom.., may be considered to be neutrally charged macroscopically, at the subatomic scale it is always a composite structure of charges components.., protons, neutrons and electrons.., as such it is not difficult to associate any motion of matter, through space — or the vacuum energy of QM, as generating a DCE. At the same time it would be difficult to associate the motion of a neutrino through space, having a small mass and NO charge or magnetic moment, as being subject to or involving an equivalent DCE. From this perspective, neutrinos may not be subject to the same inertial limitations of "ordinary" matter, composed of charged particles.
Electrically neutral masses have mutual gravitation. Even if you start with no other physics but this, finding a nexus seems impossible.
Always keep in mind that "electrically neutral masses" are never in the case of "ordinary" matter uncharged and neutral at subatomic scales. Electrically neutral refers to the organization of matter at and above the scale of atoms. Of "stable" particles below the scale of the atom, at least at present, only the netrino remains without charge and EM interaction.