I've never been overweight and, when I was 22, did gain weight when I took up weight lifting. However, the gain was all muscle.
An overweight person may temporarily gain weight upon taking up weight lifting, but generally the weight gain will be temporary. Because muscle has a higher metabolism rate than fat, the gain in muscle mass would generally be followed by a loss of fat resulting, in the long term, a weight loss.
Ideally the weight lifting would be accompanied with aerobic exercise such as running, swimming, or bicycle riding. Running may temporarily be inappropriate for someone who is very overweight since the excessive weight could cause joint problems in which case fast walking could be more appropriate. Also, unless the heart is in good condition, increasing the level of aerobic exercise too quickly could be dangerous; a visit to the doctor first could be a good idea.