Rubeus Hagrid did not open the Chamber of Secrets the first time. He was the scapegoat. The true culprit was Tom Riddle (the future Lord Voldemort), who opened it during his fifth year at Hogwarts in the 1940s.
Riddle manipulated the situation perfectly. Hagrid's love for "dangerous" creatures made him an easy target. The Ministry and Headmaster Dippet accepted the frame-up, though Dumbledore remained suspicious. Hagrid's wand was snapped, but he stayed at Hogwarts as Gamekeeper.