For me, both are similar, but "if anything" has the nuance that the option that comes after is more unexpected and usually expresses uncertainty.
e.g. "You would think that having his mom be his teacher would help him learn easier, if anything, it's probably more confusing"
"On the contrary" being used mostly leads us to believe that what happened after is the polar opposite.
e.g. "he thought that having a high IQ would make him a god at video games, on the contrary, he can't get through the first level."