The term comes from knacker, in the sense of a person who butchers elderly horses. The theory is that someone who's knackered is so exhausted and/or out of it that they're practically dead and dogmeat.
Often abbreviated to knacked, since the speaker is usually too tired to say the whole word.