It is an angry way of saying "I don't care."
"I don't care" is a plain statement.
"I don't care at all" is a stronger statement.
"I don't give a s - - t" is very strong and angry.
The anger is expressed by the use of the "bad word," "s - - t." "S - - t" is a medium-bad word. (It is bad because it is vulgar, and it is vulgar because it is referring to bathroom matters). Even if you hear it on TV or in videos, it is best not to use it because it requires a good understanding of culture to know when it is OK.
Because it is a "bad word," it sometimes signals that you are so angry that you have lost your self-control; you are so furious you don't care about offending people.
Other bad words can be substituted for "s - - t." It is just an angry noise, not a word conveying any literal meaning.