As the first post said, this story is not really true. It is interesting how we tend to tell stories about people spontaneously realizing some truth about physics or the natural world in this way. We talk about Newton's apple, or about Archimedes in his bath tub.
This seems to imply that these insights simply come spontaneously rather than as a result of hard work and thinking. I have often wondered why we so often treat scientific breakthroughs in this way.
Newton's Apple was the one that made Newton wonder what caused the falling of the apple.
The story that he was hit in his head by an apple is not true. The real story was that he was watching the falling apple from his mother's window.
Finally, he came up to the conclusion that gravity, which is a force, made the apple to fall. He also discovered that the same force is keeping the Moon in the orbit around the Earth.
The formula of the gravity is:
F = G*(m1*m2)/r^2
m1 and m2 are the masses of the bodies
r is the distance between the bodies.
g - is the gravity constant