SegWit was first introduced by a developer named Pieter Wiulle at the Scaling Bitcoin conference in 2015. In his presentation, Wiulle said that by implementing a new protocol to bitcoin's core code that removes certain data normally recorded on its blockchain and storing that data outside the block, he could fix a bug in bitcoin's code called "transaction malleability," which allows anyone to change small details that modify the details of the identifying addresses relevant to a transaction - in other words, the data that tells you who sent bitcoin to whom - as well as its subsequent hash. Others praised this proposed protocol upgrade as a potential solution to bitcoin's relatively poor scalability; by implementing this upgrade, bitcoin would be able to process more transactions per second, because less data would be required to record a transaction in a given block. This was dubbed "segregated witness," because the signature data had previously been named the "witness."
Another benefit of SegWit is that it is, from a programming standpoint, surprisingly flexible; SegWit supports implementing "second layer" protocols, meaning the protocol tends to operate smoothly with protocols built "on top" of a blockchain, such as the Lightning Network.
Not all members of the bitcoin community agreed that the upgrade was feasible from a technical standpoint. In fact, the debate became so devisive, it led to the hard fork that created Bitcoin Cash.
In August 2017, SegWit was enacted to the bitcoin blockchain. Because of how the protocol was designed, it was implemented without causing a hard fork.