Because they have a narrow fixed path, they can pass closer to people and buildings and narrow spaces
Trams can also get through traffic due to Green Wave Traffic Light Pre emption – https://bathtrams.uk/does-zurich-and-other-cities-use-green-wave-traffic-light-premption-to-speed-trams-but-not-buses/