Salazar’s reason is never truly confirmed.
It isn’t known for certain why Salazar Slytherin put the basilisk in the Chamber of Secrets. Though the often-cited explanation is that he did it so he or one of his descendants could rid the school of all those who were unworthy of studying magic, it’s unclear if this is proven anywhere or if it’s just a persistent rumor.
“The story goes that Slytherin had built a hidden chamber in the castle, of which the other founders knew nothing.
‘Slytherin, according to the legend, sealed the Chamber of Secrets so that none would be able to open it until his own true heir arrived at the school. The heir alone would be able to unseal the Chamber of Secrets, unleash the horror within, and use it to purge the school of all who were unworthy to study magic.”
- Harry Potter and the Chamber of Secrets, Chapter 9 (The Writing on the Wall)
Many people believed this, including the Dark Lord himself, who thought that he would finish what his ancestor started by opening the Chamber and using the basilisk to kill Mudbloods.
“I decided to leave behind a diary, preserving my sixteen-year-old self in its pages, so that one day, with luck, I would be able to lead another in my footsteps, and finish Salazar Slytherin’s noble work.”
- Harry Potter and the Chamber of Secrets, Chapter 17 (The Heir of Slytherin)
However, whether this truly was his plan is never actually confirmed. Professor Binns told his class that reliable historical sources said that Salazar disliked taking students born to Muggles because he believed them to be untrustworthy, and he fought with the others about it. However, he further explained that even the existence of a Chamber wasn’t in these sources. That means that Salazar’s reason for putting a basilisk in it also wouldn’t be recorded in any reliable sources, and therefore it’s not certain what it had been.
“He paused, gazed blearily around the room, and continued, ‘For a few years, the founders worked in harmony together, seeking out youngsters who showed signs of magic and bringing them to the castle to be educated. But then disagreements sprang up between them. A rift began to grow between Slytherin and the others. Slytherin wished to be more selective about the students admitted to Hogwarts. He believed that magical learning should be kept within all-magic families. He disliked taking students of Muggle parentage, believing them to be untrustworthy. After a while, there was a serious argument on the subject between Slytherin and Gryffindor, and Slytherin left the school.’
Professor Binns paused again, pursing his lips, looking like a wrinkled old tortoise. ‘Reliable historical sources tell us this much,’ he said, ‘but these honest facts have been obscured by the fanciful legend of the Chamber of Secrets.”
- Harry Potter and the Chamber of Secrets, Chapter 9 (The Writing on the Wall)
While the existence of the Chamber was proven to be true afterward, part of the story being true doesn’t prove that all of its pieces are true, and there are no other known sources stating why he chose to put a basilisk in the Chamber. Therefore, there’s no way to be certain with the information we have what the true reason why Salazar Slytherin put the basilisk in Hogwarts is.