Nam means something like "for" or "because" or "since"; it indicates that what comes next is an explanation of what came before. So in this case, Julius isn't alone, since four slaves are with him. Medus isn't with the lord, because he's afraid of the lord [when he's] angry.
Quia also means "because", but I understand quia as a reason more than an explanation; you wouldn't use quia unless you were giving the specific reason for some event, but you could use nam for any sort of clarification. The difference isn't huge, and you could just as well use quia in the second sentence here, for example: being afraid of the master is the reason Medus is avoiding him.
For your second question, apud is more about being in the vicinity of something or someone, while cum is about accompanying or being alongside them. But again the difference isn't huge, and you could say the slaves were cum eō in the first sentence with no significant change in meaning; if Julius isn't alone not alone, presumably the slaves are both "near" him and "accompanying" him.