What does すみません Sumimasen mean?

Sumimasen (すみません) apologises, gets attention, and thanks, because its sense is that something between two people is not yet settled.

Written
すみません (sumimasen)
Literally
Usually traced to 済む (sumu), to finish or be settled, in the negative: this is not settled. An acknowledgement that something remains outstanding between two people.
As slang
Everyday polite speech, used constantly. It is the workhorse of Japanese social lubrication and carries no weight of serious contrition.
In anime
Subtitled as sorry or excuse me. It also does the work of thank you, which is the use that puzzles learners most.

Sumimasen apologises. It also flags down a waiter, and it thanks someone. The third use is the one that stops learners, and it follows directly from what the word is built out of.

The construction

It is generally traced to 済む (sumu), a verb meaning to finish, to be settled, to come to an end, in a negative polite form. The literal sense is close to this is not finished, or nothing is settled here.

What is not settled is an obligation. Something has passed between two people and the balance has not returned to zero, which is a description that fits an apology and a thank-you equally well.

Why it can mean thank you

Because a favour creates the same imbalance an offence does. If someone holds a door, retrieves a dropped glove, or goes out of their way, the recipient is now carrying something. English chooses to mark that with gratitude; this word marks it as an outstanding account.

Both are reasonable descriptions of the same event. English says you have given me something good. This says I have cost you something, and I know.

The third use

To get attention: calling across a shop, interrupting a stranger, starting a question. The logic holds there too, since the speaker is about to take someone's time and is acknowledging it in advance.

One word therefore covers apology, gratitude and interruption, which are three separate English scripts, and it covers them by describing the social position rather than the emotion.

The weight it does not carry

Very little. It is said dozens of times a day and is closer to English excuse me than to a serious apology, for which Japanese has heavier options. English speakers sometimes read the frequency as excessive deference, which is a misreading of register: the word is a courtesy marker, not a confession.

The useful comparison

English does this too, in one direction only. Sorry to bother you, sorry, do you have a moment, sorry, could I squeeze past: English will happily use apology to open an interaction. What it will not do is use apology to close one, so thanking someone with sorry sounds wrong in English and is unremarkable here.

Quick answers

What does sumimasen mean?

Usually traced to 済む (sumu), to finish or be settled, in the negative: this is not settled. An acknowledgement that something remains outstanding between two people.

Is sumimasen an insult?

Everyday polite speech, used constantly. It is the workhorse of Japanese social lubrication and carries no weight of serious contrition.

What does sumimasen mean in anime?

Subtitled as sorry or excuse me. It also does the work of thank you, which is the use that puzzles learners most.