It could be related to his isolation and the path he had chosen. Sasuke had distanced himself from his friends, and Sakura might have tried to bring him back. In his state of mind, he may have seen this as an intrusion and reacted violently. His training under Orochimaru also made him more ruthless, and this ruthlessness could have been directed at Sakura when she got in his way.
Perhaps Sasuke was testing Sakura's loyalty or strength. He may have thought that if she couldn't withstand his aggression, she wasn't worthy of being in his life. Also, his own inner demons, like the hatred he carried from his past, could have flared up and led him to almost kill her without fully realizing what he was doing.
One possible reason could be that Sasuke was under some kind of mind - control or dark influence at that moment. Maybe he was influenced by an enemy's jutsu that made him lose his sense of self and turn on Sakura.
It could be because of a dark power corrupting Sasuke. Maybe an ancient evil force takes over him and makes him see Sakura as an enemy. In some fanfics, this kind of external influence can completely change a character's actions. Also, it might be related to Sasuke's pursuit of power. If he believes Sakura is standing in the way of his ultimate power - seeking goal, he could be driven to kill her.
Sakura might be in shock. She probably couldn't believe that Sasuke, someone she cares about deeply, would try to kill her. So she could be frozen in place for a moment, unable to react immediately.
One possible reason could be that Sakura has finally grown tired of Sasuke's aloof and cold behavior towards her. She might have realized that she has been constantly chasing after him while getting little in return, so she decides to ignore him as a form of self - preservation.
It could also be related to Sakura's strength. Sasuke is constantly striving to become stronger. If Sakura somehow shows a weakness or makes a mistake during a fight that he thinks could have been avoided, and it has negative consequences for their situation, he might get angry at her for not being more capable.
Sakura may initially be paralyzed by fear, but then her love for Sasuke and her own determination to survive could kick in. She might try to counter - attack in a non - lethal way, hoping to subdue Sasuke rather than harm him. She could also call out to their shared memories in an attempt to stop him from actually killing her.
One possible reason could be a sudden and extreme corruption of Naruto's character. Maybe he is influenced by some dark and powerful force that makes him turn against his friends. Another reason might be a misinterpretation of a prophecy or some kind of mind - control situation.
One possible reason could be Sasuke's focus on his revenge. His thirst for vengeance against Itachi might make him blind to Sakura's feelings and neglect her as he is constantly preoccupied with getting stronger to achieve his goal of revenge.
Maybe to explore different character arcs. The writer might want to see how Sakura would develop as a character if she strayed from her loyalty to Sasuke. It could also be a way to introduce new characters or relationships into the Naruto fanfic world.
In the fanfic, it could be that Sasuke doesn't appreciate Sakura enough. She might pour out her love and support for him, but he doesn't return it in the way she hoped. Sakura may have expected a more reciprocal relationship where her feelings are acknowledged and valued. Since that's not the case, she starts to regret her choice of Sasuke.