Will I lose quality when converting avi to mkv? I have a lot of *.avi files with either 1 audio track or several. All of them are mp3 encoded. The video codec is xvid4. 

However, when I play these avi files I can choose between the audio tracks (if there is more than 1 audio track) but they are named "audio track 1", "audio track 2" and so on. 

That's why I want to convert them into mkv files since they support audio track names. 

Would I loose any quality if I convert them?
AVI and MKV are both containers, so in theory it should be possible to transfer your contents with no further loss. I can't say for certain if MKV can wrap xvid4, but it's very likely. You shouldn't need to decode / re-encode to transfer the contents, just demux / remux.