So, segwit has nothing to do with fee(affecting indirectly though), it was generally implemented for reducing the transaction size? I used to think that it was for reducing fee.
It actually wasn't primarily implemented to reduce transaction size either, although both the transaction size decrease and fee decrease are what most users know it for.
It was initially implemented to fix the transaction malleability bug, which allows nodes to change the hashes of unconfirmed transactions. This was necessary for the Lightning Network to function. However, as a side effect of segregating the witness data, it counts the size of your transaction differently and effectively makes it smaller, meaning that we can fit more transactions in a block and you can save money on fees.
You can read more about it here:
https://github.com/bitcoin/bips/blob/master/bip-0141.mediawikiOr here (less technical):
https://en.bitcoin.it/wiki/Segregated_Witness