A while back, I was doing some research related to grades in American schools and I asked the author of several pieces on the topic a similar question. To paraphrase their response: Grades are less like the lightbulb and more like the shoe. We don't know who invented the shoe because tons of people invented the shoe. Conditions were such that the shoe was necessary and inventing it didn't require a tremendous amount of know-how.
In effect, there is no origin story for the A-F grading scale in America. We can see multiple places in the historical record when it was used, often times concurrently in different geographical locations, but there's no one Eureka! moment. (Despite what you're likely to find with a Google search.) Grades, in whatever form they take, are about communicating a teacher or professor's understanding of student's learning. Given that learning cannot be directly observed, only a proxy of learning is available to us, there is no ideal or best system. We can see, though, a history of trial and error.
First, a quick clarification: The grading scale is actually A, B, C, D with "F" as short-hand for failing - meaning, the student's performance is outside the A-D scale so they get no credit for the course or their work. Though there are isolated cases, the use of "E" to indicate "no credit" or "below D" didn't really catch on in American schools. When we're tracing the history of that scale, what we're actually looking at is a variation of the 4-point scale (which most college students know as a scale from 1.0 to 4.0. Or a 5-point variation that goes from 0.0 to 4.0.)
From a previous response of mine to a similar question:
The 4.0 scale is the OG of college grading scales [in America]. By 1783, Yale was putting students into four groups from highest to lowest: optimi (4), second optimi (3), inferiores (boni) (2) and pejores (1). By 1800, the college had switched to the corresponding numerical scale which allowed tutors to assign or dock quarter-points to students who demonstrated - or failed to demonstrate - particular character traits or habits. A student's standing was a point of honor, or shame. Grades were about competition; reward and punishment.
Given that colleges were mostly attended by young white men from families of means, the population was relatively small. Tutors could assess their students' performance via recitations (public or private exchanges in which the tutor would ask questions or provide a prompt and the student would respond verbally) and assign an evaluation summary (i.e. a grade) without being overly burdened by record keeping. As populations expanded, record keeping became an issue and different educators proposed different solutions.
A quick detour to highlight that an "A" to indicate the best of something, then B, then C and "F" or "X" as an indicator of failure was in the general vernacular in Colonial America. An example of this was Alexander Hamilton's notations on candidates he was interviewing for the Continental Army. He wrote the notation A by those he was impressed by, B by those he was considering, C by those who needed more work, and X by those he did not like. Meanwhile, some of the celebrity tutors of the colonial era used the scale or variations when reporting their son's performance to parents. It's hard to say how the association came about, but it's possible Hamilton and others picked up this ranking scale from those familiar with the Cambridge Mathematical Tripos examination which used a similar ranking classification or even the association between the Greek word alpha and the idea of something being the best.
Follow up: Why don't we use E in that scale?