The conditional -(으)면 sets a trigger and 나가다 is the leaving. 나가다 stretches further than English 'go out': stepping outside (더러워지면 나가서 'if it gets dirty, go out and…'), being thrown out (이럴 거면 나가! 'if that's how it is, get out!'), moving out of the family home, and appearing on a show — 흑백요리사 2 나오면 나갈 수도 있지 'if season 2 happens she could go on it'.