The most typical use of code names is for army operations. We British have uninspiring names. For example, Operation Herrick Afghanistan and Operation Granby Gulf War I sound more like Monty Python names than operations of war. Apparently there’s a computer in the MOD building in Whitehall that spits out random names.
Personally, I like to consider that it’s really an elderly civil servant who spends his days environment crossword puzzles until he’s called on for a random name. In comparison, after a period of automation, American code names since 1989 have been designed for PR value as much as obscurity – Desert Shield and Just Cause, as an example. There’s a fascinating list of US codenames online here.