Perhaps it could have been something another child said or something she saw on tv - perhaps even being around another child who was frightened of animals?
Don't force her to stroke animals etc, but perhaps by spending some time with people who have well behaved animals she might realise that she doesn't need to be scared! When you to visit people with animals allow her to sit somewhere out of reach (ie. on your knee if needsbe) while the animal is quietly nearby without jumping or chasing - if the animal isn't well enough trained to do this then I'm sure people won't mind closing their animal out of the room while you're there.
I'm sure this will pass so just be gentle with her and try to keep her calm when in those situations. Good luck
DS got this about the same age. before that he used to love them. I have just tried to stay a bit neutral but it was a real pain for a while, walking enywhere provoked hysterical screaming and running away and weird looks from innocent dog walkers. He is gradually calming nad is not so bad as he was. I have just been telling him that the dog / cat is going for a walk too. i have no idea where he got it from.
No solutions but DD, 3.4y, is also suddenly terrifed of dogs (although one jumped on her and I'm sure that sparked it off). I always say ooh what a nice doggie, look at its pink lead etc when we pass one, she just freezes then tries to climb me. I'm hoping it will pass - it's a bit sad really as she used to love them and 'dog' was her first word.