Hayley was previously in a psychiatric hospital.
She said "four out of five doctors agree I am, in fact, insane." This was played to be a joke, but she was serious. she was evaluated by five doctors. Four said she was dangerously insane, the fifth, though, managed to sweet-talk a judge into releasing her.
Her past and even her real identity are left ambiguous in the film. "Hayley" may either be Dexter's stepdaughter Astor or his now grown-up daughter Lily Anne from the novels. Or some other kid entirely that he had with another woman. Like her father, she is a sociopath with an urge to kill who abides by a code—probably instilled in her by Dexter himself—where she targets certain people (in her case, pedophiles/hebephiles, rapists and murderers) and follows a ritual when killing them so that she won't be incriminated (which for her would be mind-raping her victims
until they are Driven to Suicide