Klein does not connect the various meanings. He provides a number of roots - each with their own etymology:
- גור meaning "to sojourn, dwell". From here we get the words ger גר (biblically a stranger, in rabbinic and later Hebrew a convert), and migurim מגורים - "residence." He finds cognates in the Arabic jawara (=was the neighbor of) and giwar (= neighborhood). He writes that "the original meaning of this base probably was 'to turn off, leave the way', whence 'to be a stranger, to sojourn.'".
- גור meaning "to fear". Klein writes that this is a secondary form of the root יגר, which is cognate to the Arabic wajira (=he feared). Derivatives of this root include magor מגור and migora מגורה - both meaning "fear, terror".
- גור meaning "to attack." Klein finds another Arabic cognate - jara'al (=he acted wrongfully against) and says it is possible related to the base גרה meaning "to excite, provoke, irritate, tease, incite, stir up.". This is the origin of the word גרוי gerui - "irritation".
- גור - gur: this last meaning is a noun - "cub, whelp". It has cognates in a number of Semitic languages, including Arabic jarw, jirw and Akkadian gerru - both meaning "whelp."
Like Klein, he says that the original meaning of גור was "to turn aside from the way." But he manages to see that root in many of the meanings. He writes that גור is cognate to זור - which Klein also defines as "turn aside, be a stranger" (and is the origin of zar זר - "stranger" and muzar מוזר - "strange".) However, Klein doesn't connect גור and זור, but rather writes that זור is connected to סור - which also means "to turn aside."
In any case, back to Gesenius. The sense "to sojourn, dwell" originally meant "to tarry anywhere, as a sojourner and a stranger." Regarding "fear", he writes "this signification is taken from that of turning aside, since one who is timid and fearful of another, goes out of the way and turns aside from him.". And he provides two theories as to gur meaning "whelp". One is from a separate root meaning "a suckling", but a second theory says it is "so called as still sojourning under the care of its mother." (He does not connect the sense "to attack" to this common root).
Who is right? My gut instinct tells me to follow Klein, since he lived about 100 years later than Gesenius and so had the benefit of hindsight and perspective. But there is still something persuasive in the argument of Gesenius. I'll leave it to you readers to see who convinced you more. You can turn away from the theory you find less convincing, but if you have doubts, don't dwell in fear...