Yes, escoger and elegir are cognates.
Elegir comes from Latin ēligere, from ex- (“out of, from”) + leg- (“choose, select, appoint”). Note that ex- changes to long ē- before the following consonant already in Latin, as it also happens e.g. in eludir (from ēlūdere < ex- + lūdere). The shifts in Latin between e and i in the root are probably (I'm no Latinist) a kind of Ablaut. The irregularity of elegir (elijo vs. elegimos, eligió vs. elegía, etc.) is more recently evolved.
Escoger comes from the same exact morphemes plus the prefix con-. In Latin there was already colligere (“bring together, gather, collect”), from con- + leg- (note the assimilation of -nl- to -ll-), which in Spanish gives us a doublet:
- the learned form colegir (“gather, understand”) and
- the vernacular form coger (“take, grasp, grab”, from something like *[kol:i'jer] > *[kol'jer] > *[ko'ʎer] > *[ko'ʒer]; [ʒ] was then merged with [ʃ] and velarized to [x]).
(also, of course, colegio, which means both “school” and “association, professional body”).
From colligere derives the (unattested) Vulgar Latin *excolligere, whence finally Spanish escoger with (irregular, but rather common) simplification of x /ks/ to /s/.
The variation between -er and -ir between these two verbs is a matter of chance; there were many Latin verbs originally in one class that ended up in the other as the system was reorganized.
By the way: the synonym seleccionar (from selecto) also comes from this root: sēlēctum is the supine of sēligere, from sē- (“without; apart, aside”) + leg- (meaning “to choose out”); the prefix sē- is the same as in separar and seducir.