A Canadian writer filed a lawsuit against Twitter Inc. on Monday, saying the social-media platform unfairly banned her because her criticism of transgender rights doesn’t line up with the company’s politics.

Meghan Murphy, a gender-politics blogger, alleges that Twitter violated unfair-competition law when it changed its hateful-conduct policy late last year. Under Twitter’s new policy, users can be banned for calling a transgender individual by their pre-transition names or referring to them with the wrong pronouns. The suit...