This is a very good question because it contains a crucial observation: people are in general ignorant about matters they are not experts on and most of us are only experts on only a few topics.
The result of this is that people overestimate their knowledge about almost everything. The Dunning-Kruger effect is the scientific name for this and a key point most people get wrong when they learn about the Dunning-Kruger effect is that they believe it is “stupid people not understanding they are stupid”. That is wrong.
The Dunning-Kruger effect is about everyone, regardless of intelligence or education in other areas, having a natural tendency to overestimate their knowledge regarding everything they are not experts on. Everyone, regarding everything. That cannot be stressed enough.
The fact is we have a self image of a sensible, rational, intelligent, correct and knowledgeable person who sees reality as it is usually, regardless of who we are. This perspective is called naive realism in psychology.
Due to these two traits we see ourselves as far more unbiased and educated than we are about matters we are not experts in.
Additionally, it is uncomfortable and triggers an unpleasant feeling, a sort of reelingness, a sort of spinny or unpleasant feeling, maybe a hot feeling when there is evidence against our own competence and knowledge when we were certain of it. The feeling this disconfirming evidence triggers is cognitive dissonance and it was best described in the book A Theory of Cognitive Dissonance by Leon Festinger. He went into great detail about what the feeling is, what causes it and how this affects our behavior.
We generally shun the sources of cognitive dissonance in our lives. Who wants to talk to people that make us feel confused, upset, and unsure? Along with physically unwell? No one, with rare exceptions.
So, the result of all this is that if a person, say Joe, is watching Sam and Alice (two other people) talk about a subject, Joe may feel he should chime in and give his knowledge and opinion, despite Sam and Alice being experts on the topic of their conversation and Joe not being an expert and in fact not even really understanding the topic well enough to hold any educated opinions on the subject.
Joe is extremely unlikely to say to himself “I don't know my ass from a hole in the ground on this subject, I know little and have less that is useful to offer, I should just shut up.” It's possible, but unlikely.
Joe is extremely likely to overvalue his own knowledge and present it as more authoritative than it is, he may not lie, but just have more confidence than is appropriate for his understanding.
The book The Knowledge Illusion by Steven Sloman (cognitive scientist and professor at Brown University) and Phillip Fernbach (cognitive scientist and professor of marketing at Colorado's Leeds School of business) takes on this topic in depth.
The authors describe research that shows that we generally don't understand many details about the world but think we do, regarding topics we are not experts in.
We usually overestimate our own understanding of how things work like toilets, bicycles, cars, zippers, and thousands of other things. We tend to substitute our familiarity with something for expertise when it comes to estimating our own understanding.
Through asking people how well they understand things like zippers and then asking them to step by step explain how they work their ignorance can be exposed to them. First, you ask for them to estimate their knowledge, then you ask them to explain how something works, like a zipper or bicycle or coffee maker. Then they write an explanation with steps in a sequence. Then you provide an accurate explanation with the correct parts and steps in the correct sequence.
They realize they overestimated their knowledge on that topic. If you do this over and over several things happen. They become extremely uncomfortable and they don't interact with the people who showed them their lack of understanding. They don't like the people who showed them their ignorance and overconfidence and they avoid them, even if they agreed to keep seeing them.
So, it is easy to see why people share their opinions on things they don't do any factual gathering on. They mistake feeling comfortable regarding a topic and being certain they understand it with actually being educated on the topic, our usual reaction regarding most topics.
Here are several links to posts that elaborate on the scientific research and evidence supporting these claims in detail: