Firstly you was dehydrated that might be reason for having twitching in hands..
Reason is loss of
electrolytes with sweat.....
And the night problem is due to your overthinking...
Both can be solved easily...
Next Steps
you should keep yourself well hydrated before gym..during gym..
and do exercise as adviced by trainer only..
heavy lifting can cause this problem...
Health Tips
drink lots of water ..3-4 litres per day..
have peaceful sleep..