I'm not sure how severe your hypothyroidism is but beyond a point it is irreversible and requires lifelong medication. That said, you should be taking in kelp, seaweed, and other sources of iodine and selenium as those two micronutrients play a role in thyroid hormone production. That said, carbohydrate intake is also related to thyroid activity and if keto was associated with weight gain and calories have been consistent that may be part of the issue.