QUESTION
How do you remember when to use the right verb - or is it simply by memory - or are they interchangeable?
I suppose the same could be said for прийти/войти
ANSWER
Уйти = leave, go away.
Выйти (из) = exit (from some confound -- a room, a building, etc).
Прийти and войти аre the opposites of уйти and выйти, respectively.
Since the question is about mnemonics, the prefix is the key here:
Prefix у- indicates movement from "here" (from the point of view of the narrator or subject) out, elsewhere: ушел, убежал, уехал, уполз
Prefix вы- indicates movement from within to outside of something: вышел, выехал, выбежал, выполз
To illustrate, consider this narrative involving a certain education professional:
Мэри Поппинс:
- Прилетела неизвестно откуда
- Влетела в окно детской комнаты
- Вылетела (из дома на улицу) через парадную дверь
- Улетела в неизвестном направлении