백제, 신라, 고구려 (not 고루려) are the names of three old kingdoms on the Korean peninsula about 1500 years ago, i.e, the answer to the 강도's question "삼국시대 (three kingdom era)의 나라 이름". This sounds very much like the line "배쩨실라고그려" (dialect speech of "배 째시려고 그래요?" - Are you trying to cut my belly?). So the 바보 got the right answer by coincidence.
허거걱 is just an exclamation of a surprise or bewilderment. 헉, 헐, 허얼, 허걱, 허거걱 and so on.