For CBC mode, the IV must be
- Never used twice with the same key
So, in your example (filename$\oplus$key), if you ever encrypt two files that have the same filename with the same key, you will violate #1.
Now, you may be tempted to say "but I always generate a new key for every file that I encrypt, so that example doesn't apply". Fine, it doesn't. There are probably some use cases where filename$\oplus$key is fine. But, there are a lot of use cases where this will have big problems. In crypto, we typically try to develop our systems so that they are secure no matter how they are used. This is often not entirely possible, but that is what we aim for. So instead, we would generate a random IV and publish it with the ciphertext.
To give you an example of where filename$\oplus$key could have issues, consider the following. What if you publish your IV (which is a very, very common practice). Then all I have to do is brute force the file name and I have the key.