Harry Potter 2 and the Chamber of Secrets
The movie you’re referring to is Harry Potter 2 and the Chamber of Secrets, which is the second film in the Harry Potter series. It was released in 2002 and is based on J.K. Rowling’s second book in the series.
After his first year at Hogwarts School of Witchcraft and Wizardry, Harry Potter returns for his second year, despite warnings from Dobby, a house-elf, who insists that terrible things will happen if Harry goes back to school. Once at Hogwarts, strange events begin to occur. Students and even a cat are found petrified, and rumors swirl about the legendary Chamber of Secrets, a hidden chamber within the school, which is said to house a deadly creature that only the heir of Salazar Slytherin can control.
As the mystery unfolds, Harry, along with his friends Ron Weasley and Hermione Granger, discovers that the attacks are linked to the Chamber and that a dark force is at work. They suspect that Tom Riddle, a former student (whose diary Harry finds), might be the key to solving the mystery.