The story
From comedy + of + errors, probably coined by the English playwright William Shakespeare (c. 1564 – 1616) as the title of the play The Comedy of Errors (written c. 1594; published 1623), about two sets of identical twins separated at birth who are involved in a series of mistaken identities.
Etymology from Wiktionary, CC BY-SA 4.0.