It is called selective mutism. Children with this symptom usually have social anxiety when they are small. They usually grow of it when they grow up.