If you choose to represent the various parts in life by holes upon a table, of different shapes, — some circular, some triangular, some square, some oblong, — and the persons acting these parts by bits of wood of similar shapes, we shall generally find that the triangular person has got into the square hole, the oblong into the triangular, and a square person has squeezed himself into the round hole. The officer and the office, the doer and the thing done, seldom fit so exactly, that we can say they were almost made for each other.

Sydney Smith (1771-1845) English clergyman, essayist, wit
Lecture (1804-1806), Moral Philosophy, No. 9 “On the Conduct of the Understanding,” Royal Institution, London
    (Source)

This is the origin of of the phrase "a square peg in a round hole."