This is the 2275th most frequent Korean word.
하다가
"하다가" means "while doing" or "in the middle of doing."
The word '하다가' is used to indicate an interruption or a change of state occurring during the course of the action described earlier in the sentence, which is '운동을 하다'.
운동을 하다가 다쳤어요.
I got injured while exercising.
Here, '하다가' signifies the transition from actively reading to unexpectedly falling asleep during that action.
책을 읽다가 잠이 들었어요.
I fell asleep while reading a book.
In this sentence, '하다가' is used to show a sudden occurrence, meeting a friend, during the ongoing act of walking.