Sir Thomas Malory published the Morte d'Arthur in 1485. This book combines all the threads of the story that came before and becomes the source for our modern-day versions, including Howard Pyle's Story of King Arthur and his Knights (1903), T. H. White's Sword in the Stone (1938), and Marion Zimmer Bradley's Mists of Avalon (1983).
My question is, when did the sword in the stone come into the story? And is the sword in the stone Excalibur?
The sword Excalibur, or Caledfwlch in the original Welsh, is part of the earliest Welsh legends about King Arthur. Excalibur is a compound of two Welsh words, meaning hard and breach or cleft. By the time Malory publishes, he says that Excalibur means "cut steel," a nice take on the original etymology.
From the Old French prose cycle of Arthurian literature, the Lancelot-Grail (dating from 1210 to 1230 or so), Malory gets the element of the Lady of the Lake, who hands Excalibur to King Arthur. (The Lancelot-Grail material adds other elements we consider crucial as well, including Lancelot's adulterous love affair with Guinevere and his quest for the Holy Grail.)
And from Robert de Boron's Merlin, published around 1450, Malory gets the sword in the stone and the gist of its inscription, "Whoso pulleth out this sword of this stone and anvil is rightwise king born of all England." De Boron states that the sword in the stone is not Excaliber.
In the de Boron work, the fifteen-year-old Arthur, heir to the late king Uther Pendragon but in disguise as the foster son of a nobleman, pulls the sword as a stand-in for the blade his foster brother Sir Kay forgot at home. And, because he is a generous boy and humble to a fault, he lets Sir Kay take credit for the deed. Sir Kay's father calls him on the lie and Sir Kay has the opportunity to confess his sin, repent, and return to God's grace.
In later tellings, and maybe because Malory includes the sword in the stone and Excalibur without reconciling the two, as it were, the swords can be mixed up with each other.