다녀오다 comes from 다니다, so you get the verb stem 다니 plus 어/아 (in this case 어 because of the preceding vowel) for 다니어, which simplifies to 다녀 and then add the verb 오다 (to come). 다니다 itself means to go someplace in order to do something. So 다녀오다 means to go someplace, do whatever you have to do there, and come back. The meaning is similar to the expression 갔다 오다 (to come having gone (somewhere)) but the grammatical structure is slightly different and 다녀오다 has a stronger sense of going someplace and doing something as opposed to just going and returning.