Trying to replace a standard outlet with a GFCI, but found 1 white wire unused and a different white wire used in its place. What am I missing?
OK you have one 3-way switch and one duplex receptacle in the box. The black and the white wire are the carriers for the 3-way and that is where you power is coming into the box. Then the yellow wire is the switch leg that attaches to the duplex and powers it up, along with the black wire which probably goes to the fan which we will get to in a moment.

The duplex also has a white wire that looks like it is being used as a ground to the box, but the box is not grounded or is it. You need to take a volt meter and check the voltage from the yellow switch leg when it is hot and the ground to see if you get a voltage. I am betting the white wire attached to the box is worthless.

Remember when I said we would get back to the fan. Now we come to the other white wire that appears to come through the hole in the back of the box and acts as the receptacles neutral. I would like to know where this wire comes from. Is there another box on the other side of the wall or near this box where someone has scabbed a neutral and pulled through to the box? This neutral is related to the white wire that feed down from the fan. This should be the proper neutral. Is there a reason why this neutral is not being used instead of the scabbed one? I am guessing that somewhere in the past it has failed and that is why someone scabbed in the second neutral. This is a variation of what we used to call a California 3-way. Where you are using a neutral that is not the original circuits neutral.

Conclusion: You could replace the receptacle with a GFCI but it may not operate properly since the scabbed in neutral may cause an imbalance in the circuit and keep tripping the ground fault. Also it might be ungrounded not that that causes any problems with the GFCI in fact it would be more to NEC standard that what you have in place now. You also need to find open up the fan box and see if you can trace out the original neutral and find out why it is not being used and get rid of the scabbed neutral. Keep in mind that whoever did it, they did it for a reason to correct something that was not working or originally overlooked. The only question would be how many code requirements did they violate to get it working and that leads us to how dangerous is it to an unsuspecting person? 

So be careful and good luck.