A seeming peculiarity of English is that our pronouns change according to their meaning in the sentence. She doesn't love he, she loves him. Why does 'he' change to 'him?'
This is a concept known as noun cases. Old English, Modern English's grandfather language, used such cases for all nouns. Many modern languages still do so. Grasping the concept of nominative, genitive, dative or accusative noun cases can add a great deal of difficulty for English speakers trying to learn German, Russian, or any number of languages that did not simplify their noun cases over the years in the same way that English did. Finnish has around 14 noun cases!
A proper understanding of our pronouns, which still use noun cases, can not only make learning other languages easier but provide some interesting linguistic insight into our own language! We tend to convert our pronouns instinctively, without much thought to it. Let's take a deep dive into the noun cases that remain in the language and see how they function.
Nominative nouns represent the subject of the sentence. They are also usually the unchanged version of the noun. 'I', 'you', 'he', 'she', 'it', 'we', 'you', and 'they' are the nominative pronouns in English.
Genitive nouns show possession. 'My', 'your', 'his', 'her', 'its', 'our', 'your', and 'their' are the genitive forms of our pronouns. The genitive case is one case that actually does extend to other nouns in Modern English. We form this case, generally, by adding 's to a noun. For example, "This is Frank's book." lets us know that the book is a possession of Frank.
Accusative nouns indicate the object of a sentence. 'Me', 'you', 'him', 'her', 'it', 'us', 'you', and 'them' are the accusative versions of our pronouns. And now we know why she loves 'him' instead of 'he'. Because he is the object of the sentence, the word 'him' is used to reference him.
Dative nouns refer to the indirect object of a sentence. Old English differentiated between dative and accusative nouns. Modern English does not. Even the pronouns dropped this case as the language evolved.
We no longer need such cases to get our point across because Modern English relies heavily on word order and context. The sentence, "Him loves she," is not grammatically correct. If we were to hear it, we would think the person is trying to say that he loves her. In other languages, less reliant of word order, that would be a perfectly correct sentence meaning the same thing as, "She loves him". We know from the noun cases that 'she' is the subject word, and 'him' is the object word. Absent word order requirements, it is a perfectly correct sentence.
There is one more case that existed in Old English, the instrumental case. This case indicated that a noun was an instrument or a means of accomplishing something. It is included last because it cannot be replaced with word order or context alone. Instead, it was replaced with the use of prepositions. In the sentence, "He hit the ball with the bat," the bat is the instrument. The words 'with the' indicate to us what the instrumental case would have indicated to speakers of Old English. Some languages have many cases that serve the same function as our prepositions do.
So there's our blast from the linguistic past. The earliest form of English required that all nouns change their case to indicate their role in a sentence. Over time, the accusative, dative, and instrumental cases were dropped and the genitive case was simplified. For whatever reason, pronouns retained their usage of the accusative.