Your weight gain and decreased energy levels in the setting of an unchanged exercise routine and diet could certainly be caused by a thyroid problem (namely hypothyroidism, or underactive thyroid). The fact that both your mother and grandmother have had thyroid issues increases the possibility of you suffering from thyroid disease as well.
Associated symptoms of hypothyroidism include depression, depressed ability to think clearly, constipation, abnormalities of the menstrual cycle, coarsening of the hair, brittle nails, and intolerance to cold temperatures, among others.
You should certainly see your primary care physician
to help determine the cause of your symptoms. While hypothyroidism is a possible diagnosis, there are other etiologies that should be considered (for example, depression), and your doctor
can ask more specific questions about your diet and exercise routines, associated symptoms, etc. A thorough physical exam can help point towards hypothyroidism or other causes of your symptoms as well. Lastly, a routine blood test which looks at the level of your Thyroid Stimulating Hormone (TSH) is the first step in determining if your thyroid is functioning appropriately. If you are in fact diagnosed with hypothyroidism, your primary care doctor may elect to treat you or refer you to an endocrinologist
for further care.