"companion, comrade," c. 1200, from Old English feolaga "partner, one who shares with another," from Old Norse felagi, from fe "money" (see fee) + lag, from Proto-Germanic *lagam, from PIE root *legh- "to lie down, lay." The etymological sense of fellow seems to be "one who puts down money with another in a joint venture."
Meaning "one of the same kind" is from early 13c.; that of "one of a pair" is from c. 1300. Used familiarly since mid-15c. for "any man, male person," but not etymologically masculine (it is used of women, for example, in Judges xi.37 in the King James version: "And she said unto her father, Let this thing be done for me: let me alone two months, that I may go up and down upon the mountains, and bewail my virginity, I and my fellows").
Its use can be contemptuous or dignified in English and American English, and at different times in its history, depending on who used it to whom, it has carried a tinge of condescension or insult.
University senses (mid-15c., corresponding to Latin socius) evolved from notion of "one of the corporation who constitute a college" and who are paid from its revenues. Fellow well-met "boon companion" is from 1580s, hence hail-fellow-well-met as a figurative phrase for "on intimate terms."
In compounds, with a sense of "co-, joint-," from 16c., and by 19c. also denoting "association with another." Hence fellow-traveler, 1610s in a literal sense but in 20c. with a specific extended sense of "one who sympathizes with the Communist movement but is not a party member" (1936, translating Russian poputchik).
Fellow-countrymen formerly was one of the phrases the British held up to mock the Americans for their ignorance, as it is redundant to say both, until they discovered it dates from the 1580s and was used by Byron and others.