Birds and butterflies are very anatomically different, so even if their wings perform the same function, they probably evolved separately. This is called convergent evolution. The bat would be another example that fits in this category in regards to flying.