Answer by taking a quote from the following article:

Epstein was born to a secular Jewish family in New York City and raised in Brookline, Massachusetts. He attended Brookline High School (a 1991 graduate), and played baseball for the Brookline High School Warriors, but dreamed of working for the Red Sox. Epstein attended Yale University where he lived at Jonathan Edwards College. He served as sports editor of the Yale Daily News.

After leaving the position as the Padres' President, Lucchino became president and chief executive officer (CEO) of the Red Sox on November 15, 2001 and hired Epstein to work under him. At the end of the 2002 season, Lucchino appointed Epstein to replace interim general manager (GM) Mike Port. Epstein is credited with initiating the trade of Nomar Garciaparra and making key contract acquisitions including those of Kevin Millar and Curt Schilling during his first tenure as Red Sox GM. The new players were regarded as instrumental in breaking the so-called "Curse of the Bambino" when the Red Sox defeated the St. Louis Cardinals in the 2004 World Series. It was the Red Sox' first World Series championship since 1918, ending what remains the third longest championship drought in the history of any Major League team, after the Chicago White Sox (1917-2005) and the Chicago Cubs (1908-2016).  On October 31, 2005, Epstein resigned, rejecting a three-year, $1.5-million-per-year contract for personal reasons. According to The Boston Globe, "This is a job you have to give your whole heart and soul to", he said. "In the end, after a long period of reflection about myself and the program, I decided I could no longer put my whole heart and soul into it." Because it was Halloween the night he resigned from the Red Sox, Epstein left Fenway Park wearing a gorilla suit in an attempt to avoid reporters. A witness reported spotting a person wearing a gorilla suit driving a Volvo similar to Epstein's that night. The suit was loaned to him and was later auctioned for $11,000. The money raised was given to The Jimmy Fund and the Foundation to be Named Later (FTBNL).  Epstein remained in contact with the team's front office and on January 12, 2006, he and Red Sox management announced his return. Six days later, the team announced that he would resume the title of general manager and add the title of executive vice president. In November 2007, Epstein announced, at the annual general manager meeting, that he had signed a new contract with the Red Sox but declined to disclose the terms of the deal.  In December 2007, Epstein was mentioned in the Mitchell Report regarding a November 2006 email exchange he had had with Red Sox scout Marc DelPiano on the possible acquisition of closer Eric Gagne. In the email, Epstein asked DelPiano, "Have you done any digging on Gagne? I know the Dodgers think he was a steroid guy. Maybe so. What do you hear on his medical?" DelPiano replied that "steroids IS the issue" with Gagne, questioned his "poise and commitment" and expressed questions about his durability "without steroid help." Despite DelPiano's reservations about Gagne, Epstein traded Kason Gabbard and minor league outfielders David Murphy and Engel Beltre to the Texas Rangers for Gagne on July 31, 2007.

When did he leave the red sox team?
On October 31, 2005, Epstein resigned, rejecting a three-year, $1.5-million-per-year contract for personal reasons.