Hogwarts was founded over a thousand years ago (the precise date is uncertain) by the four greatest witches and wizards of the age. The four school Houses are named after them: Godric Gryffindor, Helga Hufflepuff, Rowena Ravenclaw, and Salazar Slytherin. They built Hogwarts together, far from prying Muggle eyes, for it was an age when magic was feared by common people, and witches and wizards suffered severe persecution.
For a few years, the founders worked in harmony together, seeking out the young 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.
Reliable historical sources tell us this much, but these honest facts have been obscured by the fanciful legend of the Chamber of Secrets. The story goes that Slytherin had built a hidden chamber in the castle, of which the other founders knew nothing about. Slytherin, according to 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. So far, the Chamber of Secrets has been opened twice, both by Tom Riddle (aka Lord Voldemort).
Hogwarts School of Witchcraft and Wizardry is one of the four wizard schools mentioned in the Harry Potter series. As none of the other three schools are actively discussed, we assume that Hogwarts is the dominant school out of the four. Of course, Hogwarts is protected from the common Muggles so they are not discovered. When Muggles walk by, all they see is an old run down castle instead of the fabulous masterpiece it really is! The school is protected from outside intrusion; therefore the only known ways to get into the school is by the gates.
When first year students get to Hogwarts, they are required to put on the Sorting Hat which puts them into the four house groups; Gryffindor, Hufflepuff, Slytherin, and Ravenclaw. All four houses have their strong and weak points, and all students are picked by the Sorting Hat to the group in which he or she would fit the best in. The house you are selected into will be the group of people you will live with throughout your seven years of school at Hogwarts before you are 'of age'. All houses have their own sleeping quarters and common room, along with their own traditions.