Isaac Newton formulated the law of universal gravitation which explained the motion of all celestial bodies in space known at his time. Also, he demonstrated that it is the same law that is causing everyday objects to fall to Earth.
Newton wrote that he had not been able to discover the reason for the phenomenon of gravity. Flat-Earthers use this as “proof” that he lied and he did not know anything about gravity, and that gravity was a mere fabrication. They are wrong. Gravity adequately explained the motion of all celestial bodies and the fact that everyday objects are falling to Earth. Newton simply did not know what is causing it.
In 1687, Isaac Newton wrote his book “Philosophiæ Naturalis Principia Mathematica” which explained his law of motion, his law of universal gravitation and the derivation of Kepler’s law of planetary motion.
In the second edition of the book that was published in 1713, Newton added the essay “General Scholium” in which he stated his famous “hypotheses non fingo.” He stated he had not been able to discover the reason of the properties of gravity from phenomena, and he refused to speculate.
In short, Newton certainly knew how gravity works according to his law of gravity. He simply did not know what is causing it. Just because he did not know the cause, it does not mean his law of gravity is wrong.