There are many causes of inability to gain weight
like worms in stool, depression, anorexia
nervosa, AIDS, cancers especially colon cancers, drug abuse, infections and loss of appetite. Loss of appetite can again be due to certain medications, drug abuse, depression, AIDS, acute and chronic infections, cancers and hypothyroidism. Either you do not eat well or there is increased metabolism as in hyperthyroid states, HIV, cancer etc.