At the end of every class a crowd of students would gather around the professor to ask questions for which there had been no time during the class period.
Why should it be “had been”?
First, there was no time for questions during class. Then, students gathered after class to ask those questions. The class happened before the students gathered.
The past perfect tense (“had been”) is used to help readers understand the order of events that happened in the past.