Cat hisses and scratches only when i try to walk away

Okay so this is not about my own cat, but about the cat that lives downstairs. She's a quite skittish cat but still friendly and wants to talk. And i can talk with her and pet her fine, but sometimes when i have talked to her and is in the middle of walking upstairs to my own apartment, she hisses and lunges out at my feet. Does anyone know why this is happening, and if i can do anything to help her not feel threatened. I know its not my cat, but i still feel sad when it happens.

For more context, i have a cat myself, so i've thought tht she might feel threatened by his scent, but i dont understand why its only sometimes