in (adv., prep.) Look up in at
a Middle English merger of Old English in (prep.) "in, into, upon, on, at, among; about, during;" and Old English inne (adv.) "within, inside," from Proto-Germanic *in (cognates: Old Frisian, Dutch, German, Gothic in, Old Norse i), from PIE *en "in" (cognates: Greek en, Latin in "in, into," Old Irish in, Welsh yn, Old Church Slavonic on-). The simpler form took on both senses in Middle English.

Sense distinction between in and on is from later Middle English, and nuances in use of in and at still distinguish British and American English (in school/at school). Sometimes in Middle English shortened to i.

The noun sense of "influence, access (to power or authorities)," as in have an in with, is first recorded 1929 in American English. to be in for it "certain to meet with something unpleasant" is from 1690s. To be in with "on friendly terms with" is from 1670s. Ins and outs "intricacies, complications of an action or course" is from 1660s. In-and-out (n.) "copulation" is attested from 1610s.
in (adj.) Look up in at
"that is within, internal," 1590s, from in (adv.). Sense of "holding power" (the in party) first recorded c. 1600; that of "exclusive" (the in-crowd, an in-joke) is from 1907 (in-group); that of "stylish, fashionable" (the in thing) is from 1960.