To move out from a certain place or space.
When to use
Moving outside, Passing exit, Leaving a place
The nuance
Use 나가다 when the subject moves outward from a space relative to the speaker or a reference point.
나가다 (na-ga-da, nagada) · 나오다 (na-o-da, naoda)
나가다 means to move out from a place, while 나오다 means to come out or appear from inside a space.

One lane per word — no nested boxes, just the gist.
To move out from a certain place or space.
When to use
Moving outside, Passing exit, Leaving a place
The nuance
Use 나가다 when the subject moves outward from a space relative to the speaker or a reference point.
To come out or appear from inside a space.
When to use
Emerging inside, Appearance of person/object, Moving from inside out
The nuance
Use 나오다 when something or someone emerges from inside a space or appears from a state.
나는 방에서 나갔다.
na-neun bang-e-seo na-gass-da., na neun bang e seo na gass da.
The subject moves out of the room relative to the speaker, so 나가다 is appropriate.
나는 방에서 나왔다.
na-neun bang-e-seo na-wass-da., na neun bang e seo na wass da.
Describes coming out from inside the room, so 나오다 fits well.
그는 집 밖으로 나왔다.
geu-neun jip bakk-eu-ro na-wass-da., geu neun jip bakk eu ro na wass da.
Using 나오다 with 'outside the house' is unnatural; 나가다 should be used.
그는 집에서 나갔다.
geu-neun jip-e-seo na-gass-da., geu neun jip e seo na gass da.
Expresses going out of the house, so 나가다 is correct.
문이 나갔다.
mun-i na-gass-da., mun i na gass da.
Door is not a space to move out from; 나가다 is incorrect here.
사람들이 무대 위로 나왔다.
sa-ram-deul-i mu-dae wi-ro na-wass-da., sa ram deul i mu dae wi ro na wass da.
People appear from the stage, so 나오다 is appropriate.
사람들이 무대에서 나갔다.
sa-ram-deul-i mu-dae-e-seo na-gass-da., sa ram deul i mu dae e seo na gass da.
Saying 나갔다 suggests leaving the stage area, but 나오다 is used when coming down from stage.
그는 방에서 나왔다가 다시 들어갔다.
geu-neun bang-e-seo na-wass-da-ga da-si deul-eo-gass-da., geu neun bang e seo na wass da ga da si deul eo gass da.
Describes someone coming out of the room and then going back in naturally.
Which sentence should use '나가다'?
Which sentence is appropriate with '나오다'?
Which sentence cannot use '나가다'?