The word "shudra" etymologically means one who grieves or sorrows.
In the Chandogya Upanishad there is a story where a king is addressed by the word "shudra" because he is in grief that he has not acquired the knowledge of Brahman yet.
Brahma Sutra 1.3.33 explains the usage of the word "shudra" in that context to mean "one who grieves."
Here is Ramanujacharya's commentary on that sutra:
From what the text says about Jânasruti Pautrâyana having been taunted
by a flamingo for his want of knowledge of Brahman, and having
thereupon resorted to Raikva, who possessed the knowledge of Brahman,
it appears that sorrow (such) had taken possession of him; and it is
with a view to this that Raikva addresses him as Sûdra. For the word
Sûdra, etymologically considered, means one who grieves or sorrows
(sochati). The appellation 'sûdra' therefore refers to his sorrow, not to his being a member of the fourth caste.
Shankaracharya says the same thing in his commentary on that sutra:
The word 'Sûdra' can moreover be made to agree with the context in
which it occurs in the following manner. When Jânasruti Pautrâyana
heard himself spoken of with disrespect by the flamingo ('How can you
speak of him, being what he is, as if he were like Raikva with the
car?' IV, i, 3), grief (such) arose in his mind, and to that grief the
rishi Raikva alludes with the word Sûdra, in order to show thereby his
knowledge of what is remote.
Now there is another etymology given by SAR Prasanna Venkatachariar Chaturvedi Swami which means "one who removes the grief of another through his service," because Shudras' duty is to serve.