Sonic and Shadow clash because they represent opposite answers to the same question: what does it mean to be powerful?
Shadow was created as the ultimate life form and carries that expectation everywhere he goes. He is driven, single-minded, and determined to prove he is number one. Sonic, by contrast, answers to nobody and treats freedom as the whole point of being alive. Put those two attitudes in the same room and friction is inevitable.
Their rivalry works so well because neither one is wrong. Shadow's resolve is genuinely impressive, and Sonic's refusal to be tied down is genuinely appealing. That tension is exactly what makes their encounters some of the most memorable in the series.