The awesome thing about HIIT is that it isn't just a cardio, but it is also a muscle building form of exercise. Allow me to explain. When a person runs on a treadmill for about 30 minutes at a steady pace, they are in essence getting an endurance workout because the fibers that are getting burned are the slow twitch ones responsible for endurance. When a person is working out to get stronger or faster at the something thew will usually try an go after the fast twitch fibers which give you short powerful bursts of energy which is in essence what makes you stronger. Going after the slowfast twitch fibers is done by doing short explosive movements such as quick intervals on the treadmill, or really heavy squats in the low rep range.
Based on the above information, I would say that it is absolutely ok for you to incorporate some HIIT in to your routine. I would also suggest that you do it on the days that you workout and not on your rest days.
As for how often you should do it, I would say that if you have one day of your three working days that you work on your legs that should be your day to do HIIT. If you work on your legs everyday of your working days like with the 5x5 program, than I would say say that you should make your own informed decision as for how often you should do it. Something to consider before you make that decision, is that doing more work on your legs other than the squats will increase the time it takes for your legs to recover and therefore hinder you from being able to increase 5lbs every time you squat as is suggested buy the 5x5 program (again this is only if that is the program you follow).
As for swimming it would depend again on weather you are doing it as strictly a cardio or in the form of HIIT. If you do it as a cardio it will hinder you from the muscle gaining goal you have set for yourself, but if you do it as an HIIT than again you may actually become more athletic by doing this.
EDIT: I just remembered one more thing you should consider. That is weather you should be doing the HIIT sprints before your workout or after your workout. Again this is a decision you should make for yourself, but to answer this ask yourself the following question. What is more important to you the sprinting or the rest of the workout? The simple fact is that whatever you do first will be easier for you and thus get your fullest efforts.