Somebody has to be in charge of the military. If that person is just someone promoted from within, you're never more than one person's decision from a coup d'etat, "A republic, if you can keep it". So, an elected leader it is.
Of the three branches of the US government, only one is intended to provide an executive function, to decide, in an instant where necessary, without deliberation and compromise. The President. So that's the right person for the job of ultimate military commander, and it's one of the few things about that job which the voters seem to actually have some idea about.
Both the US and UK systems are under-staffed. The UK shares the job of executive leader and legislative leader (very different skill sets) under one role "Prime Minister" - while the US shares the job of executive leader and head of state (a figurehead) which also require totally different skill sets under the role of "President". This would make sense with a very small population, but it's crazy to imagine these huge countries couldn't find two people to do these very different jobs even a little better than one man (and in the US it has always been a man somehow) can do both.