Your cat can do some confusing things: chase their tails or chirp at birds. However, one of the more confusing acts towards a cat parent is when your cat decides to seemingly randomly attack your ankles when you walk around the house.
You don 't think your cat is mad at you. You just had a snuggle session earlier, so what happened?
Don't take it too personally. There are a few reasons your cat is suddenly in attack mode when it comes to your ankles.
Cats' prey drives
Even though your pet cat is domesticated, they still have a prey drive because they are predators by nature. And your feet and ankles are the perfect sized moving target. As soon as your moving feet and ankles approach them, your cat can't help but activate the hunter they are. Whether you mean them to or not, your feet are moving just like a small animal. As much as this is inconvenient for your poor ankles and toes, it isn't about your cats' love for you—it's simply about the movement of your feet and ankles resembling that of small animals!
Your cat might think it's play time! And that you shuffling your feet around is an invitation for a game of swat the ankles! This is especially the case if your cat needs to exert some energy. When you squeal or react in a similar way, or move away this can seem like you are playing with them (which may not be your intent considering when anything runs into your foot you are bound to react). Whether you mean it or not, this reaction you have is similar to the reaction you have when playing with them, so it can be confusing for your cat.
Your cat needs more attention or affection
Sometimes your cat might bite your ankles in an attempt to get your attention or show you affection. Cats who like each other tend to groom each other, and one of the methods they use for grooming is to lick and gently bite one another's fur. It is a sign of affection for a cat and a way to get you to pay attention, but it can be unintentionally painful for your furless, naked ankles. Although, to be fair, they do get your attention that way.
Your cat is trying to tell you something
Your cat might be trying to let you know something important, like that they want you to stop doing something ("no more petting, thank you!") or they that need something ("hey, feed me!") or even that they need help ("I'm hurt/sick!"). Your cat can't talk, after all, and sometimes when they meow, you just don't get it. Try to pay attention to when your cat is biting or swatting at your ankles. Is it when they are done playing? Or around meal time? With some observation, you may be able to gauge what they want before they decide to attack those tender toes.
Psychological or medical reasons
Sometimes your cat might attack your ankles because they were taken from their mother too early as a kitten. Cats learn a lot about how to interact from their mother. When mother cats, as well as their siblings, aren't there to teach them, cats can grow up to have trouble knowing when they play too rough, or when others are communicating "stop" and "no".
In rarer cases, biting ankles and attacking feet can be a sign of hyperthyroidism. If you are worried this might be the case, a trip to the vet can easily clarify whether or not your cat has these ailments.
How to stop your cat from attacking your ankles and feet
If you want your cat to learn this is not OK, there are a few actions to take.
If your cat tends to wait around a corner for you when you walk down that one hallway, you can stop and throw a toy ahead of you, which will trigger your cat's hunting instincts while leaving you alone. If they do pounce on your ankles, make sure not to give them a reaction, and casually keep walking to the best of your ability. This will not give your cat the satisfaction of thinking it's a game, and not reward them with attention.
Make sure to give your cat attention randomly throughout the day so they don't feel like they urgently need to get your attention when you walk down the hall. If you think your cat is just too rambunctiously playful, set aside 15 minutes of playtime twice a day to play with them so they are sufficiently worn out and not yearning to create their own playtime. Your cat is most likely chasing your feet because they want let you know something so the most important thing is to listen and assess what your cat needs.