E. Cobham Brewer 18101897. Dictionary of Phrase and Fable. 1898.
Round peg in the square hole, and square peg in the round hole. The wrong man in the wrong place; especially applied to government officials. The expression was used in 1855, by Mr. Layard, speaking of the Administration Reform Association. The allusion is to such games as cribbage, German tactics, etc.
In 1804, Sydney Smith, in his Moral Philosophy, said: You choose to represent the various parts in life by holes upon a table . We shall generally find that the triangular person has got into the square hole, the oblong into the triangular hole and the round person has squeezed himself into the square hole.