Elijah was Hannah's boyfriend during their last two years of college. He is also the one who introduced Marnie to Charlie. After he ad Hannah broke up for unspecified reasons, he came out of the closet (or realized he was gay).
Elijah reveals to Hannah that he is gay in the episode "All Adventurous Women Do", when he also notably tells her that her Dad is gay. It's also revealed that he made out with Marnie once while they were in college. He becomes Hannah's new roommate at the end of the first season finale, "She Did". In the premiere of Season 2, "It's About Time", he begins hooking up with Marnie, but backs out when he thinks she rolls her eyes at him.