"What is your favorite language?"
Translation:Какой у вас любимый язык?
Твой is a possessive pronoun (your). Вас is a personal pronoun (you). Bac is how you say вы in the accusative and genetive case. You always use the genetive case with preposition "y" to form "to have" constructions. So, какой твой/ какой ваш "which is your..." Какой у тебя/какой у вас literally "which by you..." and also understood as "what is the ___ you have"
As a native English speaker, that's what I used to think, but, remember, English is the oddity here. The way I remember is this: Are you asking "What...?" or "What kind...?"? "What are you thinking about?" О чём ты думаешь? What kind of music do you like? Какая музыка тебе нравится?
Как behaves like an adverb, and means "how". Какой behaves like an adjective, and means "which".
Sometimes in English, "what" can be used in place of "which" (like this sentence), but in this case you should always translate it as какой, never что.
(Disclaimer: just learning Russian, not a native speaker)