I'm wondering if there is a common way to translate this phrase in Italian.
My Italian is rusty, but my attempt would be either "qualunque prima viene" or "qualunque che viene prima."
It'd be best translated as:
quello che viene prima,
this being the most comprehensive translation. The use of "which" indicates that the sentence is referring to a thing, an object. Moreover, the use of "whichever" instead of "whatever" underlies the idea of a comparison among different options. This is why you use the pronoun "quello/quella" plus a relative ("che", linking it to the appended relative clause). If you had "whatever", you'd use "qualunque cosa", because it means you have no idea about what is coming, no comparison is highlighted.
See these examples:
Tomorrow I'll either take the bus or the train, whichever comes first,
the best translation would be:
Domani prendo il treno oppure l'autobus, quello (dei due) che arriva prima.
But in this other case:
Whatever comes first on the table, I'll eat it immediately,
Qualunque cosa arrivi prima al tavolo, la mangerò immediatamente