Derek thought that Lydia was the Kanima because she was not affected by Peter's bite, and Stiles described her as "cold-hearted." Derek tried having her killed by his pack, even refusing to hear reason from his protege, Scott, that she could be immune. (He didn't figure out that Lydia was a banshee until much later). However, he was proven wrong when Lydia and the Kanima (AKA Jackson) emerged from the house as separate individuals.
Lydia was clairvoyance-psychologically manipulated by Peter Hale's younger self (via hallucination). He brainwashed Lydia into taking Derek hostage and bringing Peter back to life. Derek still holds a grudge against Lydia in Season 33, where he sarcastically thanks her for bringing him back to life.
Ultimately, it was Lydia's love for Jackson that allowed him to remember who he was. Derek was forced to kill Jackson (but with his consent). Thanks to Derek and Peter, Jackson was resurrected and became a werewolf at last.
Season 3[]
When Derek was driving away with Cora, he returned after hearing Lydia scream.