The first couple of times, Sir Bedivere refuses to do as asked because he does not want to throw away such a richly-jewelled sword. He hides it in the grass beside the water and pretends to have thrown it away but Arthur does not believe him and is furious. The third time, therefore, Sir Bedivere obeys. As the sword falls in the water the Lady of the Lake catches hold of it and draws it in.
In addition to understanding the sequence of Bedivere's failure to carry out Arthur's instructions to throw Excalibur into the lake, we can benefit from an understanding of the failure itself and how Bedivere's actions help to shed light on Malory's view of Arthur and Bedivere.
First, Bedivere is one of Arthur's most dependable knights and Arthur's cup-bearer, and he's been with Arthur from the beginning of Arthur's reign in the role of knight of the Round Table. Second, and more important in the context of the question, Arthur considers Bedivere to be his Marshal (or Marshall of the Army) in the struggle against Mordred and his forces. The King's Marshal, at least in a medieval chain-of-command, has absolute authority on the battlefield to act on the king's behalf, and so Bedivere would consider his own actions in light of what is best for the kingdom. When Arthur first tells Bedivere to throw Excalibur into the lake, Bedivere considers the order but then tells himself
yf I throwe this ryche swerde in the water therof shal neuer come good but harme & losse / And thenne syr bedwere hydde excalybur vnder a tree (Book X: leaf 424)
Bedivere has been asked to deprive the kingdom of what has been one of Arthur's and his kingdom's most valuable assets, and Bedivere's inability to dispose of Excalibur as requested is consistent with Bedivere's responsibility to the kingdom. After all, he is throwing away an artifact that is, as far as he knows, magical--and he is understandably concerned that harm will follow his action.
Bedivere's second failure, like his first, is based on his perception that Excalibur has value to the kingdom even without Arthur being alive to wield that power. And it is only when Arthur accuses Bedivere of contributing to his suffering-- "for thy longe taryeng putteth me in grete Ieopardye of my lyf / For I haue taken colde"--that Bedivere finally decides to carry out Arthur's command. At this point, Bedivere's concerns about the kingdom's fate cannot weigh more heavily than Arthur's comfort or welfare because Bedivere's loyalty must first be to the king and second to the kingdom.
Third, as at least a couple of scholars have noted, it is not coincident that Arthur has commanded Bedivere three times to dispose of Excalibur. As a deeply Christian writer, Malory most likely took the opportunity to elevate this scene beyond the physical and give it allusive strength by comparing it to Jesus's comment to Peter in John 18 (New Testament) in which Jesus tells Peter that he will deny Jesus three times before the cock crows in the morning, an accusation that Peter finds unbelievable (but which is accurate) because it implies a weakness of faith. Although the characters and circumstances are different, Peter and Bedivere, as well as Christ and Arthur, occupy similar positions.