Roughly speaking, I as well as some other people probably have observer following. (1) Sometimes ideas start to come to me out of nowhere, (2) then we sometimes analyze it further and either reject or accept some of these idea. My question is what are the terms for these two incidents:which part of me is responsible for generating these sometimes out of nowhere coming ideas, and which part of me is responsible for filtering and analyzing them? Why how these random ideas come from?
This broad article introduces theories of what unconscious thought is and how it relates to conscious thoughts: https://en.wikipedia.org/wiki/Unconscious_thought_theory . I recommend it.
1) All thinking is preceded by or relies on unconscious processes. Consciousness gives a narrow view of all cognition in the same sort of way that our eyes only see a narrow band of the electromagnetic spectrum.
2) This step is referred to as [mostly] 'conscious' thought/cognition. Note that the difference between conscious and unconscious processes is gradual and continuous rather than categorical; they overlap.
There's a persistent complication in your question that you keep bringing up "me". It's not necessary to resolve which self or selves were involved to discuss unconscious cognition. The self is a controversial topic. I encourage Sam Harris' book Waking Up, Chapter 2, on this topic: https://samharris.org/books/waking-up/
This would actually be the scientific approach, which has been well established for centuries:
The concept of Memory - in the field of cognitive science
Especially the differentiation between recall and recognition. Also Flashbulb memories, Eureka effect and especially Priming! are all related to preconscious or subliminal concepts
Anatomy related to memory is the (ancient) Hippocampus (which also does random activation as a process) and also the Cortex (especially prefrontal cortex) for self-awareness and consciousness.
EDIT: Because of the question, in how far my answer is related
Well to say that in the long lasting field of cognitive sciences the concept of unconsciousness is not really of a main topic, because things like Priming (which all relates to things that happened in the past and therefore always involves memory) or Eureka-Effect are inherently related to un- or subconscious processes. The wikipedia article on memory is describing concepts that are common in acedemic psychology for at least 50 years. Example: If you ask someone if he/she can remember a certain word that has been shown to them 5 min. ago (an example of the work of cognitive scientists including mathematics), this information is probably available in the persons, but it might not be retreivable in that moment - and in common language you would say that you are not conscious about that information. Priming describes this process of knowing about something, while not being aware of knowing it. So the word consciousness itself is not sufficient in describing the manifold processes that are happening. But surely all human related aspects like consciousness, memory, behavior, physiology, emotions and so on are interconnected with one-another.
Another important aspects - the brain is auto-activating and 'always-on' and is just a giant filter machine. Everything is running in parallel and is subconsciously active in an abstract layer of anatomically connections (especially involving the prefrontal cortex) or electromagnetic signals coding information over time or on any other layer that is involved in the brain as a whole. You can compare consciousness as some kind of tip of the iceberg, when a thought is strongly activated and reaches some kind of threshold.