Weight training has long been associated with muscles. It's never been thought of as a mode of exercise to engage in when trying to lose weight. However those who choose to leave strength training out of their routine out of fears it will cause weight gain will miss out on a host of benefits that can't be realized with cardiovascular exercise alone.
If you're trying to lose weight and eat less calories than you burn, you will lose weight: There's no way around that. If you're engaged in strength training while on a calorie restricted diet, you'll build some muscle but nowhere near the amount to offset the weight loss you've achieved through cardio and calorie restriction.
Weight loss happens at around 1-2 pounds per week. If you find a way to gain 1-2 pounds of muscle every week (in a clean way, steroid-free), you should probably write a book because a lot of people would buy it. Gaining muscle is a very slow process. If you're lucky, you'll gain 10 pounds of muscle in an year and since you're not eating anywhere near the amount of calories necessary for that, don't think you'll gain that kind of weight.
Strength training can actually help you lose weight faster. It'll help you keep muscle that would normally be lost during a diet which has the effect of speeding up your metabolism. Muscle is metabolically active; it burns calories even when you're not exercising. If you work to keep the muscle you have and build some new tissue, your body will be burning more calories throughout the day, increasing your calorie deficit and helping you lose weight faster.
Gain Weight While Dieting
Another very popular misconception is that if you gain weight during your diet, the reason is added muscle. If you ever tell someone that you're trying to lose weight but have actually gained a few pounds, they'll probably tell you that you've gained a few pounds of muscle and that it's nothing to worry about. Wrong!
The Bottom Line
Again, when you're eating less calories than you burn, it's impossible to gain muscle at the same pace that you're losing weight. If you're gaining weight when you're trying to lose it, the problem is that you're eating too much, not exercising enough or a combination of both.