A model has been trained on thousands of hours of speech data. When you record yourself or someone else speaking, it will detect the language being spoken. Speaking for longer will help with the accuracy, up to 10 seconds. Your data is not being sent anywhere, a permission is required to write the voice clip to memory so that you can hear if your microphone is actually picking up the spoken voice. This was made before the AI boom, certainly better products are available now, however this was using much older technology.
Currently detectable languages are currently English, French, Arabic, German, Persian, Russian, and Chinese (China). This was made in 2022.