Apart from the "speak American" nonsense, how is this issue actually handled?
If a student wants to speak Spanish in class(or any other language), can they just do that? What if the teacher or other kids don't understand Spanish?
As a teacher, it can be a difficult issue, primarily because students can speak in a non-English language to say things they shouldn't be saying. At my last school, one of my coworkers kept Google Voice Translate on her phone in her pocket at all times so she could tell what the students were saying, because often they use Spanish to say things like "fuck this bitch" to each other and we have no idea.
On the other hand, I have a lot of students who are illegal immigrants or refugees, and they don't know a lick of English. The only way they CAN learn is by speaking Spanish. Saying "You can't speak Spanish" is like saying "You can't speak" to them. I try to pair these students with a bilingual student who can explain what's going on in class in their native language, and this also means they have someone to co-learn with in their native language. I'm fortunate that our current textbook is also available in Spanish.
After a while teaching, you tend to learn to look at facial expressions to know what the students are talking about. When students are talking about math, they rarely make big smiles and big expressive hand gestures. If students are talking in Spanish like this, I say "It's fine that you are speaking in Spanish, but I need you to be speaking in Spanish
about math, not others things." If students are talking about math, they tend to have a focused look on their face, as they are trying to understand things. And that's what it generally comes down to - the appropriate thing is to allow student learning in their native language to help their learning ability.
Now, you also get kids who taunt their teachers in a foreign language because they are little jerks and know we don't understand. These students are completely fluent in English, but they are using their second language as a tool for class disruption. Some teachers I know tell these students to speak English, and I think that's fair of them. I usually say one of the 3 or 4 Spanish phrases I know back to them while nodding like I understand, which gets them to laugh, and they understand that while I know I don't understand them, I'm also not intimidated. Once I get to know a classroom, I might go over to a bilingual student and ask him or her (usually her, because the boys "don't snitch") what was said.
To sum up: it's a complex and sometimes frustrating position to be in for the teacher.