One possible reason could be that in the fanfiction, the author might explore Snape's complex past with Harry's mother, Lily. Snape's love for Lily could translate into a more nuanced view of Harry. He may see parts of Lily in Harry and that softens his hatred.
In the fanfiction, it could be that Snape is forced to work closely with Harry on some important mission. Through this interaction, he gets to know Harry on a deeper level, beyond the surface level animosity that was there in the original story. He realizes that Harry is not just James Potter's son, but an individual with his own strengths and weaknesses.
One possible reason could be that in the fanfic, Snape realizes Harry has more of Lily in him than he initially thought. Harry might show kindness or a particular trait that reminds Snape of Lily, softening his feelings.
One possible reason could be his lingering resentment towards James Potter, Harry's father. Snape and James had a long - standing feud during their school days. Since Harry looks a lot like James, Snape might be transferring his old grudges onto Harry.
One possible reason could be Snape's long - standing grudge against James Potter, Harry's father. Since Snape had a difficult past with James, he might project that onto Harry. Another reason could be that Snape is trying to protect Harry in a very strange way. He may think that by rejecting Harry, he is keeping him at a distance from the dangerous wizarding world politics and plots that Snape is often involved in.
One common reason is Snape's lingering hatred for James Potter. Since Harry looks so much like his father, Snape might take out his old grudges on Harry. He sees James in Harry and can't help but be reminded of the past bullying and his unrequited love for Lily. So, he acts hurtfully towards Harry as a way to get back at James, even if it's not really fair to Harry.
It re - imagines their relationship as more of an understanding one. Instead of the constant hostility, they might start to have moments of mutual respect.
Well, perhaps there was an emergency at Hogwarts. Maybe some dark forces were approaching, and Snape, being a powerful wizard and a Hogwarts professor, felt it was his responsibility to pick Harry up. Harry was always a target for the dark side. Also, it could be that Snape had some new information about Harry's family or his destiny that made him decide to take Harry under his wing, so to speak, by picking him up.
In some fanfictions, it could be related to Snape's loyalty to Dumbledore. If Snape believes Harry is endangering a secret plan that Dumbledore has set in motion, he might punch Harry to stop him from doing something stupid. For example, if Harry is about to reveal a crucial piece of information to the wrong person.
One possible reason could be that Snape shows a different side to Harry in the fanfiction. Maybe he protects Harry secretly from some hidden threats that others are unaware of, which makes Harry start to trust him.
In this fanfiction scenario, Snape may become protective of Hermione because she might be involved in some important magical research or discovery. Snape, being a knowledgeable wizard, realizes the significance of her work and decides to protect her from those who might want to stop or steal her ideas. Also, Hermione could be in the middle of a conflict between different wizarding factions, and Snape, for his own reasons, decides to side with her and keep her safe.
One possible reason could be that Snape is trying to intimidate Harry. He has always had a rather tense relationship with Harry in the original story, and this could be an extreme form of showing his authority. Maybe he suspects Harry of something, like being involved in some mischief or having knowledge about a certain Dark Arts item or activity.