The tree that attacks vehicles and people at Hogwarts is the Whomping Willow.
The Whomping Willow is a violent magical tree planted on the Hogwarts grounds. Its branches strike anyone who approaches, making it a natural barrier around a hidden entrance to a tunnel leading to the Shrieking Shack in Hogsmeade.
The tree was planted during Remus Lupin’s student years to conceal and protect the passage he used when transforming into a werewolf. Lupin’s friends James Potter, Sirius Black, and Peter Pettigrew secretly learned to become Animagi so they could accompany him during those transformations.
In Harry Potter and the Chamber of Secrets, Harry and Ron crash Arthur Weasley’s flying Ford Anglia into the tree. The car is badly damaged and later develops a life of its own. The Whomping Willow is different from the Forbidden Forest, which is a whole woodland rather than a single aggressive tree.