When your muscles are sore, it means you have a build up of lactic acid caused from little tears in the muscle when you worked out in the gym. This is a good thing, but the muscles repair itself with a build up of water. This is the weight gain you are seeing on the scale. It is temporary. Pushing yourself at the gym helps build strong mucscles and ups your endurance. You will be able to walk longer, go up stairs easier, etc. Drink lots of water! Successful weight loss isn't always seen on the scale. You could actually stay the same weight but go down 2 pant sizes because of exercise. Good luck!