One reason could be that in this fanfiction, Snape has some hidden kindness towards Harry that he doesn't show in the original story. Maybe he secretly protects Harry from other threats, which makes Harry feel safe around him.
In the original series, Harry and Snape have a very tense and often hostile relationship. But in this fanfiction, their relationship is likely to be much more positive. Harry feeling safe with Snape means there is a sense of trust that was absent in the original.
One possible reason could be that Snape has shown unexpected kindness to Hermione in the fanfiction. Maybe he has protected her from some danger secretly, which makes her feel she can rely on him and thus feel safe.
One possibility is that the fanfic changes Snape's backstory to make him more sympathetic. Harry, being empathetic, then feels safe around him. For instance, if Snape's past is shown to be full of hardships that made him act the way he did, Harry might understand and feel safer in his presence.
In some fanfictions, it could be that the author has rewritten Snape's character in a more approachable way. Maybe Snape shows a side of himself that is protective towards Harry, like secretly guiding him in his magic studies without the usual harshness, which makes Harry feel safe.
In the original series, Snape is often quite harsh towards Hermione. However, in this fanfiction, the relationship is completely different. Here, Hermione feels safe with Snape, which is a huge deviation as in the original, she would be more likely to be on guard around him.
One scenario could be that Snape saves Hermione from a Dark Arts spell gone wrong. As he catches her in his arms after deflecting the spell, she feels safe because he has just rescued her life.
In some fanfictions, Snape might use his advanced knowledge of potions to create a special concoction to heal Harry. He could draw on his skills in Herbology as well to find rare ingredients for the potion.
Fanfiction allows for a lot of creativity. Perhaps the story is set in an alternate universe where Snape and Hermione have a different dynamic. Snape could have redeemed himself much earlier in this universe, and Hermione has come to understand his true nature. So when he holds her, she feels safe because she knows he is on her side, that he has changed from the cold and strict professor she knew in the original story.
One more to consider is 'Snape: Beyond the Surface'. In this story, the author explores Snape's relationships with other characters like Dumbledore and McGonagall. It shows how his interactions with them were not always as straightforward as they seemed in the original books and adds more depth to his character.