I've taken atenolol 4 years. My doc changed that to metoprolol 30 days ago. Now I cannot lose weight and am gaining. Could the metoprolol cause this?

Yes. Metoprolol crosses the blood-brain barrier exerting central nervous effects.
Unlikely. If the dose is equivalent, it's not the change in the medication that's causing the weight gain, especially since you have been with this drug class for the last 4 years.