I hope this actually has an answer, I couldn't find anything but speculation on the web.
Basically, the story of Odin hanging from Yggdrasil is very similar to that of Jesus on the cross. Here are the stories broadly:
In order to learn of the runes that are used to control the worlds odin hangs himself from the great world tree Yggdrasil, and stabs himself with his spear. He forbids the other gods from helping him, and he then hangs there for 9 days, staring into the dark waters below, after which he gains the knowledge he searched for. Doing this was basically him making a sacrifice of himself to himself, a sacrifice that made him worthy to obtain the knowledge he wanted.
Jesus is put on trial by the Romans and sentenced to death. He is put on a cross, on which he claims his father (God) has forsaken him. He dies, which is confirmed by stabbing him with a spear. He descends to hell, but comes back after 3 days, after which he has sacrificed himself (basically to himself in a different person), after which the sins of the world are forgiven.
(Note these may be somewhat loose interpretations and include things added by religions based on the texts instead of being in the original texts)
So the similarities I see: Both are being sacrificed by hanging from something and being stabbed by a spear, are in darkness (hell/the dark waters below) for 3 or 3x3 days, without help from other deities, having now sacrificed themselves to themselves for the greater good.
Now supposedly the Odin story is older, but as far as I'm aware we get it from Snorri Sturluson, who we know has added some christian motives in his other works (the Prose Edda for example).
Are there any reasons to think the Odin story is not based on the Jesus story? And if so, is there any way the Odin story could have affected, or shared an origin with the Jesus story? Or is it just a coincidence?