There is no Lego Harry Potter game for PS2. The series launched on newer consoles (PS3, Xbox 360, Wii) requiring better graphics/processing for intricate details.
PS2 had Lego games like:
You may be conflating one of these with Harry Potter. Let me know the specific game for more details!