On Oxford Dictionary we can read:
baker's dozen: a group of thirteen (= one more than a dozen, which is
twelve)
Origin.
late 16th century: from the former bakers' custom of adding an
extra loaf to a dozen sold, this constituting the retailer's profit.
More historical reasons are illustrated on Wikipedia with regard to "Worshipful Company of Bakers":
The Worshipful Company of Bakers is one
of the Livery Companies of the City of London. The Bakers' Guild is
known to have existed in the twelfth century. From the Corporation of
London, the Guild received the power to enforce regulations for
baking, known as the Assize of Bread and Ale. The violations included
selling short-weight bread and the addition of sand instead of flour.
(So that they could avoid punishment for inadvertently selling a
short-weight bread, bakers added a thirteenth loaf to a dozen, giving
rise to the term baker's dozen.) The Bread Assize remained in force
until 1863, when Parliament repealed it.