Which do you prefer, physics or chemistry?

Literal

Physics [and-と] chemistry [comparison-だと] which [subject-が] liked is?

どちらが好きですか is the standard 'which do you prefer?' pattern. と connects the two choices. だと reframes the comparison scope. A classic textbook question structure.