You are using some false assumptions here.
The first one is that just because you thought the interview went well does not mean that they thought it did. I've interviewed people in the past who thought they did a great job in the interview and couldn't believe they weren't selected. Often, they did not do nearly as well as they thought they did. We are not looking just for technical skill but for fit with the team. And some technical skills are more important to us than others. And sometimes what you think is the right answer to a question is not what we think it is.
Next you assume you should get the job because you are qualified for the job. Most hiring managers try never to even interview people who are not qualified at least on paper. So likely all your serious competitors for the job were qualified. Qualifications may get you the interview, they do not get you the job.
Next is the assumption that just because you did well, you are entitled to the job. But you forget that this is a competition. Other people may have done as well or better than you did in the interview. If I have one position and three people I would love to hire, I still can't hire all three, I don't have the budget for that.
Next you seem to feel you are entitled to some sort of explanation from the people who didn't hire you. Why on earth would they ever do that? Is there any benefit to the company in telling candidates why they were not hired? No. Is there any risk? Yes.
Another hard truth is that sometimes a job was created for a specific person, but company rules mean they have to interview several people. When this happens, no one except the person they created the job for is going to get the job. It doesn't matter how well you do on the interview. The best you can hope for in this case is that they will be impressed enough with you to want to consider you seriously the next time they have an opening. Making them mad by complaining about not getting the job and pestering them as to why, puts you out of the running for any future openings too. I'm not saying this is the case with this job, but it may be because they have personal ties to the person they hired.
Even if this isn't the case, it still may work out better for the guy with personal contacts. If the hiring manager is comparing Joe, a person he has worked with before and who he knows to be reliable, dependable and great problem solver, to Harry, who seems to be very qualifed but who he only knows from the interview, which one is going to interest him more? The sure bet of Joe who he knows can do the job even if he needs to get up to speed on one of the technologies (but he has seen him do that before) or Harry who he only knows from an hour interview? Add into that mix the fact that the last guy they hired who seemed really qualifed didn't work out. Most people would hire Joe under those same circumstances. That doesn't say anything bad about you, just that they view Joe as the less risky hire. If Joe had not applied, then they might have chosen you. There is a reason why many companies offer bonuses to employees who recommend someone. That is because people with a personal recommendation are a much smaller risk to hire. A bad hire is expensive for the company. Hiring known candidates takes much of the risk away.