A situation when two or more people speak at the same time
Solution 1:
If you are interested in a single word, consider babel:
A confused noise made by a number of voices.
‘the babel of voices on the road’
Oxford Living Dictionaries
Not to be confused with babble, although it can be used as a synonym.
Hearing only babel, the teacher could not understand them.
Hearing only babble, the teacher could not understand them.
Your question is also open to phrases. The phrase talk over each other is most common in situations where more than one person are trying to make their point to either each other or to the same listener, but are not letting each other finish before speaking themselves. However, it seems to be a close match to the situations you posit.
They were talking over each other, and the teacher could not understand them.
However, the word simultaneously is a good single word to replace the phrase at the same time.
While perhaps more commonly used, babble is not specific to multiple people, and connotes rapidity in speech which is not part of your description. This difference in precision is likely unimportant in your example usage, since the usage context should sufficiently make clear the intended meaning.
The mass noun definition of babble makes it a near synonym to babel:
The sound of people talking simultaneously.
‘the answers were difficult to hear amid the babble of conversation’
Oxford Living Dictionaries
However, babble has a singular form:
Foolish, excited, or confused talk.
‘her soft voice stopped his babble’
Oxford Living Dictionaries
And its verb form specifically calls for rapid speech:
Talk rapidly and continuously in a foolish, excited, or incomprehensible way.
‘they babbled on about their holiday’
Oxford Living Dictionaries
Babel is particularly appropriate in the case that there are multiple conversations being spoken simultaneously in more than one language, but the multi-lingual aspect of it is only to more closely match the Biblical metaphor.
5But the Lord came down to see the city and the tower the people were building. 6The Lord said, “If as one people speaking the same language they have begun to do this, then nothing they plan to do will be impossible for them. 7Come, let us go down and confuse their language so they will not understand each other.”
8So the Lord scattered them from there over all the earth, and they stopped building the city. 9That is why it was called Babel — because there the Lord confused the language of the whole world. From there the Lord scattered them over the face of the whole earth.
Genesis 11:5-9
More about the myth of the Tower of Babel can be found on Wikipedia.
In common usage, it just refers to the incomprehensible noise of many people talking.
It is interesting to note that although babel and babble sound similar and have similar definitions, they are not etymologically related. Babel was taken from the Bible, and was a translation of the Hebrew name for a city that was referring to Babylon.
Origin section of ODO
Etymology section of Wikipedia
Etymonline
On the other hand, babble seems to come to English from the German word babbelen, perhaps from Latin babulus or Greek barbaros, and probably originated as onomatopoeia of baby-talk.
Origin section of ODO
Etymonline
Solution 2:
They’re “talking over each other”.
This expression is frequently heard on television talk shows--the host pleading with the guests not to talk over each other. A Google search of "please don't talk over each other" will be productive, e.g.,:
Wolf Blitzer to Hillary Clinton and Bernie Sanders during a 2016 primary television debate:
“If you're both screaming at each other, the viewers won't be able to hear either of you, so please don't talk over each other,” Blitzer asked.
Email to Barbara Walters of the View, 2014 or so:
Please, please, please don't talk over each other on the View. When all of you do that, the viewing audience cannot hear what anyone is saying.
Although the OP's question seems to concern teachers, the photo does not appear to be students with a teacher, but rather adults dressed for the workplace.
Typical human conversations often include interruptions and digressions, but "talking over each other" is especially pertinent to two or more people answering a question or making a point simultaneously to an interviewer or a teacher.
The phrasal verb is "to talk over [someone] [each other]". The same phrase has another meaning: to discuss something to resolve differences: "to talk [it] over."