The Sword of Gryffindor represents Harry’s ability to choose his own identity. Throughout much of the book, Harry worries that he does not actually belong in Gryffindor because the Sorting Hat tried to put him in Slytherin. However, at the end of the book, the Sword of Gryffindor appears out of the Sorting Hat, which in turn allows Harry to conquer the basilisk. This demonstrates that even though Harry has many qualities that make him similar to Slytherin’s heir Tom Riddle, Harry chooses to oppose the values that Riddle and other dark wizards uphold. In using the Sword of Gryffindor to slay the basilisk, Harry chooses courage over cowardice, respect over prejudice, and loyalty and friendship over hatred and isolation—all choices that allow him to forge his own identity.
The Sword of Gryffindor Quotes in Harry Potter and the Chamber of Secrets
He might not see what use Fawkes or the Sorting Hat were, but he was no longer alone, and he waited for Riddle to stop laughing with his courage mounting.