Because it’s the same photon (electron)!
They are two entangled photons, separated by many kilometers.
When one is affected, the other switches its spin with a time latency 100,000 times less than the speed of light, if light was somehow otherwise communicating the change.