That is tapeworm. Tapeworms cause hunger - they get all of the good stuff and you get the crap that is left over from the food you eat. Usually tapeworms do cause weight loss - but in some folks they cause some weight gain.
No surgery is needed - your body will work out the dead matter. The knot was probably where the tapeworm had attached its head.