According to Wichita State University, Isaac Newton discovered gravity sometime during the summer of 1665. However, the book where Newton first wrote of this finding, "The Principia," was not published until July 5, 1687.
Between the summer of 1665 and July 5, 1687, there is record of Isaac Newton's communication with other scientists regarding laws of gravitation. He made three important discoveries during the summer of 1665 while Trinity College was shut down because of the plague. These discoveries included calculus, the components of white light, and theories of motion and gravity.
According to Newton himself, he observed an apple falling from a tree while he was drinking tea. He realized that the same force which caused the apple to fall also caused the moon to orbit the earth.