What's the distinction between "opposite" and "contrarian"? Are they basically synonymous but the latter is more suitable for written English?
They are not synonymous. Contrarian is a narrower term and refers to a person who takes a minority viewpoint which is opposite that of the majority (or it refers to those unorthodox beliefs themselves, eg "contrarian ideas"). They are both suitable in writing or speaking, but contrarian has less application because it is more narrowly defined. The word opposite doesn't contain in its definition what it is opposed to, whereas contrarian implies that the thing is opposed to the majority.
It's not really true to say contrarian is "more suitable for written English". As this NGram shows, contrarian is a relatively rare word:
(with estimated results counts contrarian:137,000 against opposite:78,500,000)
I've no doubt the vast majority of even that relative small number of usages will be in the noun sense. And in any case, means [someone] prone to adopt a contrary position, not simply [someone/something] opposing. So the short answer to OP's question is - no, they are not synonyms. In a very restricted sense, a contrarian attitude is also an opposing attitude, but that's about as far as it goes in terms of interchangeability.