(Click the character infographic to download.)
Professor Severus Snape is Potions Master at Hogwarts and Head of Slytherin House. He is also a former Death Eater and current member of the Order of the Phoenix. Harry and Professor Snape have hated each other since the first moment they clapped eyes on one another in Book 1. But we find out a bit more information on why in Book 5, and it does not reflect well on James Potter, Harry's father. Professor Snape has always implied that James Potter was a conceited jerk, but it's only once he begins Occlumency lessons with Harry where we see any evidence to back up his claims.
Occlumency is supposed to be the art of protecting your mind from magical surveillance, which means that it's all about stopping people from reading your memories, thoughts, and feelings. People who are good at Occlumency (like Professor Snape) are supposed to be able to control their feelings and blank their minds. But in Book 5, Harry isn't in much of a position to blank his mind: he's filled with so much anger that he's extremely vulnerable to Professor Snape's mind probes. As a result, his Occlumency lessons get awkwardly personal all too quickly.
As far as training goes, pretty much all that Professor Snape seems to do is to shout Legilimens!, search Harry's mind, and expect Harry to figure out some method of throwing Professor Snape out. Professor Snape gets glimpses of a lot of things Harry doesn't want him to see: his abusive relatives, his neglected childhood, and above all, his run-ins with Voldemort. As Harry becomes a bit better at pushing back into Professor Snape's mind, he also starts to see a few things Professor Snape doesn't intend: a weeping Snape as a young child watching a man yelling at a pretty young woman. Once Harry starts improving in Occlumency, Professor Snape uses a Pensieve to store the memories he doesn't want Harry to see.
One day, when Harry reports for his usual Occlumency-related torture, Draco comes running in with a message from Professor Umbridge that she needs Professor Snape's help with one of the Slytherins. Professor Snape dismisses Harry from "remedial Potions" (since he's supposed to be keeping the Occlumency lessons a secret) and leaves his office. Harry stays behind and steals a look at Professor Snape's Pensieve. Now, this is one of the most morally dubious things Harry does in the whole series, we think. Obviously, he feels irritated because Professor Snape treats him unfairly and continues to snatch looks at Harry's memories. But to look in the man's Pensieve…well, it's not great for Harry, either morally or, in the long run, emotionally.
What Harry sees in the memory is Professor Snape at around age 15. He also sees his father, Sirius Black, Remus Lupin, and Peter Pettigrew sitting around and relaxing under a tree after taking their OWLs. They're bored and looking around for easy prey. Then, Sirius spots something to do: Snivellus Snape. He and James march over and start hexing Snape completely unprovoked. They mock him and tease him in front of a crowd of jeering students. Remus Lupin doesn't join in, but he doesn't try to stop his friends either. Peter Pettigrew roars with laughter at the sight.
As Sirius and James keep torturing Snape, Lily Evans – the future Lily Potter – comes along and shouts, "Leave him ALONE!" (28.234). She thinks James is a bullying, arrogant jerk. Snape, humiliated, shouts that he doesn't need the help of a Mudblood, a derogatory term for a Muggle-born witch. James tries to come to Lily's defense, but Lily tells him to shut up: James is as bad as Snape is, with his showing off and his bullying. Suddenly, Harry finds himself being pulled out of the memory. Present-day Professor Snape is so angry that he shoves Harry out of his office and warns him never to come back. But now, Harry has a lot to think about: both James and Sirius seemed like puffed up, bullying jerks. And how could Lily ever grow to love James when she clearly hated him in Snape's memory?
Suddenly, Professor Snape's loathing of Harry seems a lot more understandable (though still not excusable, since all of this happened long before Harry was born). Professor Snape obviously associates James Potter with public humiliation and bullying. He's transferred those bad feelings onto Harry in much the same way that Sirius has transferred his positive feelings of friendship and brotherhood onto Harry. Professor Snape is so furious and hurt that Harry has seen these memories that he refuses to start up Occlumency lessons again.
Even Dumbledore reflects, at the end of the novel, that, "some wounds run too deep for the healing. I thought Professor Snape could overcome his feelings about your father – I was wrong" (37.124). Harry's discovery of Professor Snape's unfortunate youth doesn't give him much more sympathy for Snape, but it does shake his faith in his father and godfather. Professor Snape's revelations help to encourage Harry's issues with authority.
After Sirius's death, when Harry looks back at all the fights that Sirius and Professor Snape had over the past and over Sirius's activities with the Order, Harry feels a boiling rage against his Potions master. Oh, there's never been any love lost between the two of them, but now, Harry gets positive pleasure out of blaming Professor Snape because it makes him feel less guilty over his own part in Sirius's death:
Snape – Snape g - goaded Sirius about staying in the house – he made out Sirius was a coward — [...] Snape stopped giving me Occlumency lessons! [...] He threw me out of his office! (37.119-20).
Professor Snape's behavior throughout Book 5, as he singles out Harry for taunting during Potions class and mocks Sirius at Number Twelve, Grimmauld Place, makes him an easy target for Harry's loathing at the end of the novel. This clearly sets up a new conflict for Book 6: how can Harry and Professor Snape work together on the same side when they hate each other so much? And how can Professor Snape truly be a force for good when he clearly loathes pretty much all of his fellow Order members and most of the rest of the world, besides? Book 5 provides a necessary foundation for Professor Snape's future plot development: the revelation of his worst memory humanizes him a bit more the readers (though not yet for Harry).