Mr Gilderoy Lockhart is one of the two secondary antagonists (alongside the Basilisk) of Harry Potter and the Chamber of Secrets, and the secondary antagonist of the 2002 film adaptation.
He is potrayed by Kenneth Branagh, who also portrays Viktor Cherevin and Dr. Arliss Loveless and also plays Dr. Frankenstein in the film version of the novel.
Lockhart is a handsome and extremely self-absorbed and narcissistic wizard who has built a reputation for himself as a heroic wizard celebrity. In reality, he is not only a completely incompetent teacher, but a fraud who has used his only real talent - memory charms - to erase other wizards and witches memories and take credit for their accomplishments.
After Ginny Weasley is taken into the Chamber of Secrets, Lockhart immediately plans to leave Hogwarts instead of rescuing her, revealing himself to be a coward. When Harry and Ron force him to help them find her, he attempts to erase their memories in order to save his reputation. Unfortunately for him, he uses Ron's malfunctioning wand and accidentally erases his own memory. He was later seen in the book version of Harry Potter and the Order of the Phoenix in St. Mungo's for Magical Maladies and Injuries in the Permanent Resident Ward where he has recovered to the point of being able to write letters though he no longer knows why. While Ron feels guilty about putting Lockhart in this situation, Harry isn't since he knows Lockhart was at fault for erasing his own memories when he was trying to erase theirs. According to J.K. Rowling, he never fully recovered from this mishap.
Lockhart is the secondary antagonist of the film, though he was a hidden villain for most of the story.