I guess you might be confusing the very unfortunate use of the acronym CTF for security-related programming games with the usual meaning of Capture The Flag, as in a game mode in First-Person Shooters where people work as a team to capture enemy's flag and bring it back to their base.
I recognized your confusion because not so long ago, I also had it. I started hearing about reputable security conferences having "CTF tournaments" and was all like "oh cool, they're playing shooters for prizes, go geeks!" and then was disappointed when I discovered that someone just stole the term CTF to call pentesting contest with it (it takes a lot of imagination to say that a file is "a flag"...). Not to say those games aren't fun - and I am very excited about Starfighter - it's just I don't like stealing names with well-established meanings and using them to something completely unrelated and not really fitting.
I retract my point about "stealing names". I guess that this application of term CTF just wasn't known widely outside INFOSEC field and that's why a lot of programmers (like me) get confused, as security conferences become more recognizable in the mainstream.
The wiki article has a short discussion of how that morphed into video game terminology, which is the etymology that I'd expect without having researched it.