The Whomping Willow is a very valuable, very violent tree planted alone in the middle of the school grounds. It was planted the same year that Lupin arrived at Hogwarts (c. 1971) to disguise the opening to a secret passage from Hogwarts to the Shrieking Shack. Lupin would go through a hole in the Willow's roots every month to transform into a werewolf in the Shack where he couldn't hurt anyone. The Willow was so dangerous that it kept other people from entering the passage and encountering the werewolf.
No one was ever told what the Willow was really for. What people did know was that it would attack anyone who came within reach of its branches.