There is this thing called psyche, which involves; body, collective unconscious, personal unconscious and consciousness.
Collective unconscious is the part of us that we all share, jung said that its on our genes. structures within the collective unconscious are called archetypes. inherited parts of the psyche, structuring patterns of psychological performance linked to instincts, hypothetical entity, irresentable in itself and only evident trought its manifestations. archetype is symbol producing machine.
These archetypes usually have an effect on already existing complexes or new complexes may born from associating manifestations on some particular thing.
Personal unconscious contains all memories and fantasies either repressed or just havent met suitable conditions yet(latter is the same with archetypes). structures within the personal unconscious is called complexes. "clusters of feeling toned associations around common theme", this common theme can be anything from money to your favorite shirt to your mom, can be both good and negative.
Archetypes can attach themselves to these complexes and shape it. Like if you know a girl named amie, she seems very different person to you if shes just anybody or if the amie complex has been affected by anima, even tho shes still the same person, you just see her differently, because the amie complex(or feeling toned associations around it) has been affected by anima.
Then there is the consciousness. consciousness possesses a level of intensity, so all weak concepts remain unconscious. consciousness deters incompatible material and these remain unconscious(this could be inferior function or anything else outside functions). consciousness holds a momentary adaptation to situation.
Ego is the structure in consciousness, jung listed 5 core functions of ego, stability of personality(it doesent want to make you switch personality every day, so it doesent want to see you as a feeler either, because it sees you as T), stability of identity(you feel yourself after you wake up the next morning, not michael jackson), cognition(you know how to calculate 1 + 1 etc. but also all other conscious evaluation, judging, making sense of perceptions etc), executive functioning(you know how to walk etc to survive your day), reality testing(expect and obey laws of physics).
Now when we derive a complex from out unconscious, the ego takes a beating from the complex and suffers from reduced ability to operate appropiately. complex sort of steals the show and later we might notice that we behaved in unusual ways. its that the behavior of our normal personality was replaced by behavior motivated by complex, this is usually negative behavior, but quite often pretty useful and needed for the situation.
Then there is this thing called compensation, which means balancing, adjusting and supplementing. psyche tries to compensate one sidedness of the consciousness. ego is compensated by the unconscious(collective and personal). cba to explain more about this, but this is why the unconscious functions want to come into consciousness, why archetypes appear etc.