There are lots of possible causes for swollen ankles. Some can be serious but many others are minor. Start here:
https://www.nhs.uk/conditions/oedema
For example, my dad's swollen ankles were as a result of heart problems (due to his overfondness for beer), whereas my swollen legs are the result of damage to my lymph nodes from cancer. Totally unrelated to that, I've previously had a swollen ankle as the result of an infection getting into the tissue, resulting in cellulitis. So there's definitely no single answer to your question!
If the problem persists, consult your GP to find out what's behind it.