First of all, you have to know that, in cryptography, the term “witness” is used to describe a solution to a cryptographic challenge.
Segregated Witness (SegWit) refers to a change in Bitcoin’s transaction format. As we have seen in the UTXO chapter, when you create an UTXO, you put a locking script and, to use that UTXO as input in a new transaction, you have to provide an unlocking script. This unlocking script is a witness.
Before SegWit, every input in a transaction included the witness used to unlock it. The unlocking script was part of the transaction and its content was also used to calculate the transaction id (txid).
With SegWit, the transaction format moved the witness data out of the transaction, in a separate structure.
Witness is a more general term for an unlocking script or scriptSig.