In Book I Chapter 5 the events are described that lead up to Arthur pulling the stone from the sword for the first time. The sword appears in the churchyard of the "greatest church in London" (15) when the kingship of England is in doubt. It says on the stone that "whoso pulleth out this sword of this stone and anvil, is right-wise King born of all England" (16). Since none of the lords of the realm have been able to move it, it remains in the churchyard under guard.
On New Year's Day a great joust and tourney take place, and all the people have gone to watch it. This includes all the people at Sir Ector's (Arthur's foster father) house, and the ten knights guarding the sword. On the way to the joust with Arthur and Sir Ector, Arthur's older foster brother Sir Kay realizes that he has forgotten his sword. He sends Arthur back home to get it, but when Arthur arrives he is unable to get in because everyone has left. So, remembering the sword in the stone, Arthur runs to the churchyard and
...found no knights there, for they were at jousting; and so he handled the sword by the handles, and lightly and fiercely pulled it out of the stone, and took his horse and rode his way until he came to his brother Sir Kay, and delivered him the sword.
Kay tries to take credit for it, but Sir Ector soons finds out that Arthur is the one who pulled the sword from the stone. It takes successes over a period of time for the barons to accept Arthur as their king, but in the end he is crowned.
Source: Mallory, Sir Thomas. Le Morte D'Arthur. Janet Cowen, ed. Vol. 1. Middlesex, Eng.: Penguin, 1987.