The parts of speech are indeed named according to their function in a sentence. For example:
* Nouns name people, places, things, or ideas (function: subject, object, etc.)
* Verbs express action or a state of being (function: predicate, action, etc.)
* Adjectives describe nouns (function: modifier)
* Adverbs modify verbs, adjectives, or other adverbs (function: modifier)
* Pronouns replace nouns (function: subject, object, etc.)
* Prepositions show the relationship between a noun or pronoun and another word in the sentence (function: connector)
* Conjunctions connect words, phrases, or clauses (function: connector)
* Interjections express strong emotion (function: exclamation)
Each part of speech has a specific role in constructing a sentence, and their names reflect those roles.