The phrase is conventionally attributed to Sir Isaac Newton in a letter to Robert Hooke in 1676 -
"What Descartes did was a good step. You have added much several ways, and especially in taking the colours of thin plates into philosophical consideration. If I have seen a little further it is by standing on the shoulders of Giants."- but has been traced back to Bernard of Chartres; John of Salisbury wrote in the 12th century:
"Bernard of Chartres used to say that we are like dwarfs on the shoulders of giants, so that we can see more than they, and things at a greater distance, not by virtue of any sharpness of sight on our part, or any physical distinction, but because we are carried high and raised up by their giant size."Further details at Wikipedia.
Addendum: Readers jk and Casey remembered additional information about Newton's classic line. After some additional searching, I found at The Inverse Square Blog this suggestion that Newton may have been making fun of Robert Hooke as a "vertically impaired" person:
On March 3, 1703, a very short giant died, and a greater one of average height may well have laughed to hear the news.Details of the Hooke/Newton relationship at the Inverse Square blog link. Hooke certainly had a remarkable scientific curriculum vitae - see the list of his investigations at Wikipedia.
Robert Hooke has had the historical misfortune to have produced an extraordinary career that has been obscured over time — and in his own day too — by the still greater accomplishment of Isaac Newton. He compounded that ill luck by being something of an ass. His fate was sealed, at least in the intellectual politics of late 17th century London, by having chosen perhaps the worst person possible to annoy. Newton took offense easily, and nurtured his grievances indefinitely....
In his last letter to Hooke on the various issues involved, written in February 1676, Newton grandly acknowledged that Hooke had “added much in several ways,” to the science of light. And as for himself, “If I have seen futher iti s by standing on ye shoulders of Giants.”
How sweet — but for that in that famously touchy age, the fact of Hooke’s modest height gave the conventional phrase a nasty edge both men could have recognized....