I see this kind of behavior happen a lot online, and asked ChatGPT about it:
Yes, there is a term that describes this phenomenon. It's called "oppositional belief perseverance" or "belief polarization." This term refers to the tendency of individuals to cling to their initial beliefs even when presented with evidence that contradicts those beliefs. In the context you described, someone may initially take the opposite side of a discussion due to an opposition bias, but over time, they may start to internalize and genuinely believe the opposing viewpoint, thereby demonstrating belief polarization.