Will I gain weight by doing weightlifting?
Yes and no. Doing weight lifting will set the stimulus your body needs to grow (gain muscle mass), but lifting alone will be of no use. Imagine that your caloric intake was 1000 kcal per day (extreme value, just to make the point) while lifting. If your caloric intake would not suffice to supply you basic functionality (movements, keeping temperature, etc.), how should you gain any mass?
How many calories should I eat then?
While I think that in former times way larger values have been promoted, state-of-the-art seems to be a caloric surplus of around 500 kcal on training days (depending on the source in the 300-600 kcal range).
Getting your macros right
Another important factor is the macros. If you are mostly eating fats and (especially) carbs/sugars you will have a hard time gaining muscle mass (you will most likely gain fat if you are on a surplus). You'll have to intake protein to a certain extent. There is much ado about the exact ratios of protein/fats/carbs and I will not make a recommendation here, but it won't be too hard to find ballpark figures online. Anyway, make sure to avoid unprocessed foods as far as possible. Don't be too dogmatic, but processed foods are (often) packed with minor quality nutrients that might be detrimental to your progress.
Strength ≠ Mass
I've talked about how to gain mass. Now let's see how to avoid it. First thing to note is that strength and muscles are not the same. You can get way stronger without bulking.
The effect of the reps
Besides what you eat, another important factor is the number of repetitions per set. To gain strength without gaining mass, you should stick to a lower rep count. Strength regimen is (depending on the exercise) around 4 to 6 repetitions, while classic mass regimen is around 8 to 12 repetitions.