The phrase "You are a gentleman and a scholar" most likely originated in England in the 18th century. During this time period, scholarly pursuits and noble manners were seen as important characteristics among men.
This phrase was made popular in modern times when it appeared in J.D. Salinger's novel, "The Catcher in the Rye." The protagonist, Holden, says this to his roommate Ackley. "I reached up from where I was sitting on the floor and patted him on the goddam shoulder. 'You're a prince, Ackley kid,' I said. "You know that?...You're a real prince. You're a gentleman and a scholar, kid."