What's the behaviour of downplaying the importance of something you wanted but didn't get called? I've seen this phenomenon in various pieces of media, but recently observed it in real life and I'm wondering what it's called.
Basically, when you want something but don't get it, you downplay the importance of that thing.
I've mostly seen it depicted as &quot;moody teens&quot; using responses like &quot;I didn't want to go to that party anyway&quot;, or &quot;you can keep your stupid X, I didn't want it anyway&quot;.
In  general, rationalization is:

... a defense mechanism in which controversial behaviors or feelings
are justified and explained in a seemingly rational or logical manner
to avoid the true explanation, and are made consciously tolerable—or
even admirable and superior—by plausible means.

The specific case mentioned in the question is one of Sour Grapes, from Aesop's fables:

The story concerns a fox that tries to eat grapes from a vine but
cannot reach them. Rather than admit defeat, he states they are
undesirable.

&quot;Defense mechanism&quot; however, is a psychoanalytic (Freudian) construct, which is generally considered pseudoscience or outdated.  The more modern theory of cognitive dissonance now subsumes what was previously thought of as rationalization:

In practice, people reduce the magnitude of their cognitive dissonance
... by changing the conflicting cognition [or] Ignore or deny
information that conflicts with existing beliefs.