Not to beat a dead horse, but this is so run of the mill that I would hesitate to even really call this nepotism.
I also work for a very large fortune 50 type company that actually does a pretty solid job IME of hiring the right people (and I say this as someone who has lost out on a role in this manner before...). I've been working in technical/quality type roles for 9 years and during the bulk of that I was responsible for hiring and mentoring young engineers.
I don't mean this to be patronizing, or worse, condescending, but this is a tough thing to talk about and I find that I can't really be anything but blunt about it. This is a hard lesson about the working world that I find just about every bright technical person has to come to terms with at some point - being the smartest/most competent rarely lands you a promotion. As you climb the ladder, being super technically knowledgeable becomes less and less critical at a very rapid rate. Most mid-level managers haven't directly worked on something in so long that even if they were competent at one point, they aren't anymore.
You're doing the things that make you a better version of the you in the role you're currently in. The peter principle is REAL. If you're developing yourself in a way that makes you the best fucking CNC operator they've ever seen, they'd be dumb to make you anything but a CNC operator.
This is the key - and the part that's sort of hard especially if you've never done it before - put yourself in the shoes of the guy hiring. When he's hiring a supervisor, he doesn't need someone who can run every machine in the shop because that's not the supervisor's job. He wants a guy that can keep the peace on the floor, deal with everyone's bullshit, and because he probably has to spend a lot of facetime with the guy, someone he likes seeing on a day to day basis. He's imagining what it's gonna be like to sit with you in meetings for a dozen hours a week. Why the hell would he hire someone he doesn't really like?
It's total bullshit, but being friendly and likable is important, and the more you get to supervisory roles the more it becomes an actual job qualification. Resisting it is shooting yourself in the foot, and that's exactly what you did by complaining on the back end. Again, think about it from the bossman's perspective; even if you were the most persuasive person in the world and he agreed with you 100%, what exactly was he gonna do? Nothing - he could do literally zero about it without creating a much much bigger headache. You had zero to gain from that, besides to let him know you were mad, which long term maybe hurt you a lot.
So - the decision was probably made before you walked into the interview, so stop beating yourself up over it. It's not your fault, that's just the way the chips fall sometime. However - you've gotta embrace the social aspect of work, or be okay with missing out sometimes because of it. There are companies out there where the most competent guy gets promoted every time, but they are also CUT THROAT and that's a completely different environment with it's own set of problems (mainly people stabbing your ass in the back for credit).