The idea as stated in the OP wouldn’t work, for reasons related to synchronizing in time but actually much more subtle. In this case it has to do with information theory, of all things.
If you were trying to cancel out a single frequency sine wave, which is a very pure and dull tone to the ear, you could do it with an excellent recording and careful synchronization. It would be difficult, but they do much harder things when they synchronize cell phone equipment and other such stuff.
But it’s pretty much white noise coming from the computer fan. There’s only a little bit of a pitch or any other specific pattern to the sound.
To cancel it you’d have to put a microphone inside the headphones and give the right feedback so that the microphone got zero total sound, I think. In answer to another question, typically the noise cancellation doesn’t cancel the entire source, it just cancels it in a tiny space next to your ear. That’s where this microphone would be.
White noise doesn’t have any special pattern to it. In this sense it is like what your old fashioned modem would send down the phone line. If there were a constant pattern to the sound, that component of the information could be separated out and sent as a message like “add the following pattern back into the sound at the other end”. Just like if you wrote a letter and inserted the Gettysburg Address at every 1000th character space, obviously a file compression mechanism could figure out how to replace it with a marker and make the file so much smaller. So, when a modem is operating in a highly efficient mode where compression has been used to eliminate superfluous patterns, and therefore use all of the signal to represent the nonpattern part of the information, it makes white noise. Your computer fan makes white noise because of the tiny eddies of air swirling around into ever smaller and smaller vortices, but the result is the same. There’s no organization to take advantage of to compress the information content it any further.
Eventually white noise and fine air turbulence turn into heat, which is a special statistical distribution of molecular motion that is completely disorganized with respect to patterns. The idea of entropy comes up in two places - information theory and thermodynamics - and this area is where the two are actually common with one another.
So any recording of the white noise coming out of a fan would not match the white noise coming out at another point in time, any more than random number generators create duplicate sequences for extended times.
I think this is a very subtle point, and think that before about 1900 or so nobody in the world would have been able to explain why the OP idea wouldn’t work.