Confirmation bias is another one of those logical fallacies that we commit without realizing it. Confirmation bias is the tendency to pick up on and remember evidence that supports some hypothesis we hold while forgetting everything that might disprove it.
It's not necessarily intentional. Perhaps you just noticed over the past few days that a lot of your friends with green eyes are scientists. Then you made the association that scientists have green eyes more often than people in other professions. Confirmation bias then primes you to remember when you meet another scientist with green eyes. But if you meet a scientist with blue or brown eyes, the encounter won't seem as significant to you and you will casually forget about it. It may actually be the case that most scientists have brown eyes, but the green-eyed ones are the ones that catch your attention.
Alternatively, consider looking out over a parking lot and seeing one red car and then another and another and pretty soon you're noticing red cars everywhere you look. Perhaps you form, consciously or not, the hypothesis "red cars are more popular this year than previous recent years."
But how do you know the current number of red cars is greater now than in previous years when you hadn't been paying that much attention to it before? Once you form your hypothesis, you can't just assume it's true. You have to take in all the evidence and weigh it as appropriate. Well, you do if you actually care enough to make a systematic survey of eye color frequency across professions or car color fluctuations over time. If you don't feel like putting in the effort to properly test your hypothesis, then you will just have to let it go.
Confirmation bias doesn't just come up when you notice details that may suggest a trend. It is also possible to have a pre-existing notion that you never bother to question or might not even be aware of and from there, collect bits of "evidence" that support your idea. Think of politics in the United States. From an early age, our parents tend to teach us to identify with one party or another without really understanding what either one represents or does. When we finally start to pay attention to politics and current events, it is so easy to remember all of the ridiculous statements and ideas made by the opposing side and so very hard to admit to yourself that they might not be 100% insane when, on occasion, they utter something reasonable.
Beyond a certain amount of conscious manipulation of a hypothesis or set of evidence, confirmation bias turns into something more like cherry picking or ad hoc rationalization. As always with logical fallacies, the best way to avoid confirmation bias is to be aware of its existence. Recognize when you are unintentionally ignoring evidence that is contrary to your beliefs or assumptions and remember that if you want to come to a significant, well-substantiated conclusion, you have to weigh all the supporting evidence against all the contradictory evidence. If you don't, then all you are left with is a spurious anecdote and that's nothing to base a winning argument on.