Witch hunt is a phrase used when a group or individual is being pursued and threatened due to the belief that they are involved in nefarious dealings in some manner. The phrase originates from literal witch hunts (like the Salem Witch Trials in 1692) in which individuals were accused of witchcraft and arrested. Many were executed in the belief that they were witches and countless innocent victims were persecuted. All of this was legal with the town rulers being in charge of the trials and punishment.
There is a psychological component to this in the knowledge that many of the accused were different in some way from the majority of the group. This shows basic ingroup-outgroup thinking which can lead to negative consequences.
An example of a more modern metaphorical witch hunt can be seen with the McCarthy Communist trials in the 1940s and 1950s where many Americans were accused of harboring Communist sentiments and were put on trial. Many (if not most) of the accused were innocent and many citizens had their life ruined.