The authorities did not know about the Chamber of Secrets or the Heir of Slytherin
While it was well-known the second time around that the attacks were related to the Chamber of Secrets and the Heir of Slytherin, there is no evidence that the authorities in Riddle's time knew of any connection between the Chamber, the Heir, and the attacks.
Indeed, the only reason it was known the second time was that it was advertised:
Something was shining on the wall ahead. They approached slowly,
squinting through the darkness. Foot-high words had been daubed on
the wall between two windows, shimmering in the light cast by the
flaming torches.
THE CHAMBER OF SECRETS HAS BEEN OPENED. ENEMIES OF THE HEIR, BEWARE.
When Riddle opened the Chamber while still a student in Hogwarts, he would likely not have advertised this. Advertising it would make it more likely that the plan would get thwarted and it would also greatly increase his chances of getting caught. He was clearly in Slytherin, and it was certainly possible that someone (probably Dumbledore?) could figure out his lineage. Riddle would likely not have risked this. Indeed, he shut down the entire plan just because he wanted to be able to stay at Hogwarts over the summer.
Moreover, it is evident that even the second time around people were hesitant to attribute the attacks to the Chamber of Secrets/Heir of Slytherin. We see Professor Binns still insisting that the entire existence of the Chamber and its monster was just a legend, and it doesn't seem that he was unique in this belief. And this was after a girl was killed by the monster.
Moreover, in the entire discussion between Riddle and Dippet about the situation there is no mention of the Chamber or the Heir. They merely refer to it as "the current circumstances", "all these attacks", "the recent tragedy", and "this unpleasantness":
“The thing is, Tom,” he sighed, “special arrangements might have been
made for you, but in the current circumstances. ...”
“You mean all these attacks, sir?” said Riddle, and Harry’s heart
leapt, and he moved closer, scared of missing anything.
“Precisely,” said the headmaster. “My dear boy, you must see how
foolish it would be of me to allow you to remain at the castle when
term ends. Particularly in light of the recent tragedy . . . the
death of that poor little girl. ... You will be safer by far at your
orphanage. As a matter of fact, the Ministry of Magic is even now
talking about closing the school. We are no nearer locating the — er
— source of all this unpleasantness. ...”
Riddle’s eyes had widened.
“Sir — if the person was caught — if it all stopped — ”
“What do you mean?” said Dippet with a squeak in his voice, sitting
up in his chair. “Riddle, do you mean you know something about these
attacks?”
“No, sir,” said Riddle quickly.
But Harry was sure it was the same sort of “no” that he himself had
given Dumbledore.
Dippet sank back, looking faintly disappointed.
“You may go, Tom. ...”
When Riddle confronts Hagrid, Hagrid does not defend himself by arguing that he could not have been the Heir of Slytherin and Aragog is not the monster from the Chamber. He merely asserts that Aragog didn't do it and would never do something like this:
“It never killed no one!” said the large boy, backing against the
closed door. From behind him, Harry could hear a funny rustling and
clicking.
“Come on, Rubeus,” said Riddle, moving yet closer. “The dead girl’s
parents will be here tomorrow. The least Hogwarts can do is make sure
that the thing that killed their daughter is slaughtered. ...”
“It wasn’t him!” roared the boy, his voice echoing in the dark
passage. “He wouldn’! He never!”
This makes sense if we assume that Hagrd had no idea this was connected to the Chamber/Heir.
Harry himself only found out that the Chamber of Secrets had been opened previously from Dobby:
... And now, at Hogwarts, terrible things are to happen, are perhaps
happening already, and Dobby cannot let Harry Potter stay here now
that history is to repeat itself, now that the Chamber of Secrets is
open once more — ”
Dobby froze, horrors truck, then grabbed Harry’s water jug from his
bedside table and cracked it over his own head, toppling out of
sight. A second later, he crawled back onto the bed, cross-eyed,
muttering, “Bad Dobby, very bad Dobby ...”
“So there is a Chamber of Secrets?” Harry whispered. “And — did you
say it’s been opened before ? Tell me, Dobby!”
Dobby probably knows this because of inside information he picked up while working for the Malfoys, as we know tha the Malfoys knew about the Chamber of Secrets:
“You know I haven’t, Goyle, how many times do I have to tell you?”
snapped Malfoy. “And Father won’t tell me anything about the last
time the Chamber was opened either. Of course, it was fifty years
ago, so it was before his time, but he knows all about it, and he
says that it was all kept quiet and it’ll look suspicious if I know
too much about it. But I know one thing — last time the Chamber of
Secrets was opened, a Mudblood died. So I bet it’s a matter of time
before one of them’s killed this time. ... I hope it’s Granger,” he
said with relish.
However, there is no reason to assume that any Hogwarts/Ministry authorities were aware of this while Riddle was in school.
When Harry and Ron visit Aragog, Aragog does make it sound as though the people fifty years ago knew about the Chamber and the Heir:
“But that was years ago,” said Aragog fretfully. “Years and years
ago. I remember it well. That’s why they made him leave the school.
They believed that I was the monster that dwells in what they call
the Chamber of Secrets. They thought that Hagrid had opened the
Chamber and set me free.”
However, this could simply be Aragog's interpretation of the events, with him assuming that the people knew about the Chamber, when in reality they had simply believed that Hagrid had a generic monster that was behind the attacks.
It is possible that Dumbledore knew about the Chamber the first time around. He does explicitly acknowledge that it has been opened before:
“What does this mean, Albus?” Professor McGonagall asked urgently.
“It means,” said Dumbledore, “that the Chamber of Secrets is indeed
open again.”
Madam Pomfrey clapped a hand to her mouth. Professor McGonagall
stared at Dumbledore.
“But, Albus ... surely ... who?”
“The question is not who,” said Dumbledore, his eyes on Colin. “The
question is, how. ...”
And from what Harry could see of Professor McGonagall’s shadowy face,
she didn’t understand this any better than he did.
However, this does not necessarily mean that he knew it at the time, and even if he did it is possible that no one else believed him when they heard his fanciful ideas about a secret chamber with a legendary monster, or perhaps he never even told anyone because he didn't expect anyone to believe him. (The fact that he says that it's a question of how and not who seems to imply that he knew that Voldemort was behind the attacks, and therefore that Riddle was the culprit the first time.)
As for Riddle's statement that he was surprised that no one realized Hagrid couldn't be the Heir or have figured out how to open the Chamber, that may simply be him talking from his perspective. He knew that the Chamber of Secrets and the Heir of Slytherin were involved so he projected that onto others, without realizing that they didn't know this information. Alternatively, he was surprised that they didn't figure out that the attacks were related to the Chamber/Heir and that therefore Hagrid couldn't have been the culprit.
As for why Hagrid was arrested the second time around (once everyone knew about the Chamber/Heir), it may simply be because it was already accepted that he was guilty the first time so it was assumed that he was the perpetrator again, even though it was highly implausible. Additionally, it is likely that even Fudge didn't really believe that Hagrid was guilty but just needed to do something.
As for why people suspected Harry as being the Heir, there was some evidence in favor of such a theory. After all, he was a Parselmouth which was the trademark of Slytherin, and he was the only known one to have been at Hogwarts. Combined with the fact that he had defeated Voldemort, which may have been evidence of dark powers, and he was discovered at the scene of the crime multiple times, and one of the attacks was against someone who had been harassing him, and there weren't many other candidates, this may have helped people believe that he was the Heir.