5e rangers are spellcasters because way back in the very first days of the D&D Next project, before playtesting had even started, WotC ran several polls about what elements people thought were essential to each of the core classes. One of these polls was regarding the ranger and spells, and IIRC had options for “the ranger should not cast spells,” “the ranger should cast spells,” and “the ranger should cast some spells, but only a few and only at at high levels.” I actually voted for a few spells at high levels, but I’m pretty sure that was the least popular option; people who wanted no spells obviously didn’t like it because it some spells is more than no spells, and people who did want spells didn’t like it because if you only get a few spells at high level, they won’t be of any use anyway.
From what I remember, spells won by like 2/3, but it was a long time ago so my memory of the numbers is probably not accurate. Regardless, at the time more people wanted spells than not, but there was still enough desire for no spells that they at least tried spelless ranger twice in Unearthed Arcana. Predictably, people didn’t like the specific execution of the concept so WotC dropped the concept entirely. Like they do.