There are a couple of different ways this can happen. The first, and most common, is when kids accidentally use slang that you've never heard before. I know what you're thinking. "I'm young! I'm relatively hip by internet standards! I know current teenage slang!" No. You don't. Are you going to be on butt for the thunder game tonight? I didn't think so. They think it's hysterical to find out you don't know certain slang and will delight in teaching it to you. Check Urban Dictionary before using any slang, though. Toot it and boot it sounds like a fun, rhyming phrase, but it means to attempt to have sex with someone and then kick them out. Many aging hipster teachers have fallen into the trap of repeating words that have bad meanings.
An obvious example of code-switching is having ESL (English as a Second Language) students. We have a large Hispanic population at our school. When having informal conversations between classes and before school, some of my students will flip back and forth between English and Spanish frequently. We are not an ESL school, so often times students who are more adept at using English will flip to Spanish during a lesson to help their friends who may not understand.
The example that gets kids in trouble the most involves inappropriate language. Sometimes students come from families where cussing is a frequent part of language in the home. Sometimes they don't even notice when they cuss. This is the one we have to work on "fixing". The problem with the language is that it can stand in the way of a student getting a job in the future. Part of high school is preparing students for future education. The main part of high school is preparing students for the real world where you have a job, pay bills and take care of yourself. This is one of those extended lessons that goes on in high school that most people never even realize is important. When you come from a "good" family, surrounded by "good" kids and going to "good" schools, you understand when not to swear. You don't need this lesson. Sometimes my students do.