When the Romans built their republic, they gave power to old men and named the institution after them. The Senate — from senātus, from senex ('old') — was a council of elders. Senior is the comparative form of that same word: simply 'older'.
The Proto-Indo-European root *sen- meant 'old', and its descendants govern titles of respect across Europe. Spanish señor, Italian signore, French seigneur, and English sir all trace back to this root. When you say 'sir', you are using a word that has been worn smooth by centuries of use but still means 'elder'.
The English word entered via Anglo-French in the 14th century, initially as a way to distinguish the older of two people with the same name — John Senior vs John Junior. The broader sense of 'higher-ranking' followed naturally: in most medieval societies, the older person held the higher position.
The root's less flattering descendant is senile, from Latin senīlis ('of old age'). Where senior implies the wisdom and authority of age, senile implies its decline. Senator sits between them — a title that honours age while demanding competence. The full family reveals a culture's ambivalence: old age brings both reverence and anxiety.