The obvious answer is pretty simple: graduation order determined time-in-rank seniority, so they were considered for promotion before anyone else, and this both continues and compounds throughout their career.
Is there an actual correlation to military performance? Probably, and probably slightly more so for the academy than other schools, because of the way that subjects are taught. I later went to several other name-recognizable universities, and there are large differences in the pace and depth of what is taught and tested, with the academy having a much greater pace over much more material at a much lighter depth, so it’s kind of like testing your ability to take in a lot of information very quickly and react to it, rather than master a domain of knowledge and creatively expand upon it.
There is also a social effect of named leaders to gain support among a cohort, especially in ‘minority’ populations, which are formed by commissioning source in the military officer corps. For example, Westmoreland was “first rat” at The Citadel, which has a much lower admission standard than West Point, but it was a brutal program with fierce advocacy among graduates.