1620s, "kindred, partaking of the same nature or natural characteristics," from assimilated form of Latin com "with, together" (see con-) + genialis "of birth," thus, "kindred" (from PIE root *gene- "give birth, beget," with derivatives referring to procreation and familial and tribal groups). Sense of "agreeable" is first recorded 1711 on the notion of "having natural affinity." Also compare congenital.
<a href="https://www.etymonline.com/word/cogenial">Etymology of cogenial by etymonline</a>
Harper, D. (n.d.). Etymology of cogenial. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/cogenial