Symbols don't have set meanings. They can have multi-layered or overlapping meanings, and some mean different things to different people or in different cultures. Interesting paragraph at Wikipedia regarding symbols:
The psychologist, Carl Jung, who studied archetypes, proposed an alternative definition of symbol, distinguishing it from the term "sign". In Jung's view, a sign stands for something known, as a word stands for its referent. He contrasted this with symbol, which he used to stand for something that is unknown and that cannot be made clear or precise. An example of a symbol in this sense is Christ as a symbol of the archetype called "self".
So, yes, butterflies can have to do with transformation, since the caterpillar wraps itself up in silk and later emerges as a butterfly. But they are also distinctive for their relatively large, colorful wings, which makes them an obvious symbol for the air element. They also appear to drift on a breeze at times, and to have not a care in the world, so that causes us to think of them as symbolizing happiness and contentment, and in some cases freedom. They do something called "mudding" in which they land on damp earth and suck moisture out of it to sustain themselves. That might cause us to think of them as resourceful and adaptable. They're also a sign of the warmer season, of an abundance of flowers that will become fruit.
Because they can have so many meanings, context is important when interpreting symbols. For the butterflies in Swords cards, I like that saying, "Thoughts have wings," or the poem, "To Althea from Prison" by Richard Lovelace. We are always free in our minds, no matter what is going on with our bodies. That is, as free as we allow ourselves to be.
Our thoughts also, if left to themselves, have a tendency to meander as a butterfly does, from flower to flower.