The story
This “square” has nothing to do with shapes. In the 1500s, “square” already meant fair and honest, and a steady, trustworthy person could be called “a square man.” So “fair and square” says the same thing twice, for emphasis. Its first known use is in a 1604 essay by the English thinker Francis Bacon.