Pain in the back of the head when doing compound movements in the gym? Is it exertion headache or a strained muscle?

Either. It can be either. Although, if it occurs only in the gym, it is more likely exertional HA. Might also be high blood pressure, brain aneurysm. It is important to get that symptom checked soon, and avoid straining until you do!