Albus Dumbledore wills the sword of Godoric Gryffindor to Harry Potter, but Minister Scrimgower refuses to give it to Potter, stating the sword belongs to the school and it remains in the possesion of the new headmaster, Severus Snape.
After the Neville, Luna and Ginny try to steal the sword from Snape's office, Snape sends the sword to Gringots to be held in the Lastrange vault. In fact this sword is a fake. The true sword remains hidden in Snapes office behind the portrait of Dumbledore.
Snape leaves the real sword for Harry to find (and in fact leads it to him with his Patronus (the dear of Lily Evans Potter). The sword is later stolen by the golbin in Gringots, who maintains it was forged by goblins and so belongs to goblins.
The sword makes a final appearance when it is pulled from the sorting hat by Neville Longbottom and used to kill Nagini.