Sometimes we use modal verbs to show that we are making a deduction. We show that we are using the evidence we have to decide whether something is definitely true, maybe true, or definitely not true.
If we want to show that we think our evidence shows that something is definitely true we often use must:
- This animal has feathers. It must be a bird of some kind.
In the example above the speaker is saying that their evidence tells them that the animal is definitely a bird.
If we think evidence shows that something is possibly true, we sometimes use the verb might:
- It's going to rain tomorrow, so we might get wet.
The speaker above is saying that it is possible that they will get wet.
When we want to show that something is definitely not true, we sometimes use can't:
- That animal can't be a mammal, because it has feathers.
Here the speaker is saying that their evidence shows it is impossible that the animal is a mammal. Some speakers, might use must and a negative verb phrase:
- That animal must [not be a mammal], because it has feathers.
In British English we do not like to use must this way. Most British English speakers will not find the sentence above grammatical. However, some speakers of American English will find the sentence perfectly fine.
Notice that if we want to say that our evidence tells us now that something was definitely not true in the past, we use can' and a perfect construction:
- That animal can't have been a mammal, because it didn't have feathers.
This sentence is perfectly grammatical (excuse the pun!). We do not need to use could here.
The Original Poster's sentence
Tom walked into a wall. He can't have been looking where he was going.
This sentence means that the evidence shows that it is definitely not true that:
- Tom was looking where he was going.
We could try to phrase this sentence using must. Some speakers will not find this good, although they will understand it:
Tom walked into a wall. He must not have been looking where he was going.
We can make it more acceptable if we don't negate must but negate one of the verb phrases:
Tom walked into a wall. He must have been not looking where he was going.
Note: There is an interesting question about can't and mustn't on our sister site, ELU.
Hope this is helpful!