Sometimes my lower body swings when I'm doing pull-ups. Is it bad to swing the lower body when doing pull-ups? Are there any benefits to keeping it immobile?
Involuntary swinging of the lower body during a pull up is usually a mark of low core strength.
Try to reduce the swinging but you really shouldn't force it to be immobile as that could lead to other complications. But do try to work hard on your core strength. Swinging during the pull up reduces the effect on the muscles you want to be targeting (as @JohnP notes in his comment).