Symbolism, Imagery, Allegory
When Fawkes the phoenix brings Harry the Sorting Hat in the Chamber of Secrets, the Hat produces a ruby-covered sword for Harry. Harry uses that sword to kill Slytherin's basilisk. The sword originally belonged to Godric Gryffindor. Harry's ability to draw it from the Hat to kill Slytherin's monster represents a fairly straightforward confrontation between good versus evil: Harry is on the side of one of the good founders of Hogwarts, not the pureblood-preferring bigoted one who eventually left the school.
At least, that's the black-and-white Slytherin-versus-Gryffindor story we're getting early on in the Harry Potter series. This equation of Gryffindor = good, Slytherin = bad becomes more problematic with the introduction of Peter Pettigrew in Book 3 and, of course, the revelation about another character (we don't want to spoil it!) in Book 7.