If the Wikipedia is right, he apparently wanted to prevent them from forming families - that'll make some enemies. "...While he was a judge on the Fifth Circuit, Duncan refused to identify a transgender defendant by their assumed name..." shows the heckling isn't exactly disccordant with his conduct as a judge.
I’m sure his politics don’t align with everyone’s, especially Stanford students. But if you invite a judge to give a lecture to a bunch of law students and they disagree - there’s a much better way to show the disagreement.
Ideally, I would want my law students to behave differently in an adversarial scenario. To show they can have wildly opposing viewpoints and act professionally. To take down their ideological enemy while maintaining decorum. To actually be morally superior and correctly self-righteous. Should they have had a discussion of that prior to this collision? Probably.
Ideally, definitely. In my local university, a similar situation occurred, and while the students didn't attend the lecture, they ridiculed him relentlessly on the way back to his vehicle. Behavior spreads and I think that type of thing has a frustrating idiocy. I think it just trains the dumber systems in your brain. The idea that the students had nothing to empathize with or understand is frustrating too however, and seems to be the implication in some of the discussion. The environment has primed everyone in that Stanford class to act that way, it is pretty sad.