V+(으)려다가 is a shortened form of V+려고 하다가, which means that you intended to do one action but changed your mind or gave up, and did something else instead. In colloquial speech, V+(으)라 그러다가 can be used:
아랍어 수업을 들으려다가 돈이 없어서 혼자 공부했어요.
I was going to take an Arabic class, but I didn't have money so I studied alone.
병원에 가려다가 안 갔어요.
I was going to go to the hospital, but I didn't.
한식을 먹으려다가 일본식을 먹었어요.
I was going to eat Korean food, but then I ate Japanese food instead.
한국어 학당에 다니려다가 마음을 바꾸었어요.
I was going to go to a Korean language school, but I changed my mind.
여름 동안 한국에 다시 가려가다 태국 여행을 했어요.
I intended to go back to Korea during the summer but ended up going to Thailand.
등산하려다가 바람이 많이 불어서 집에 있었어요.
I intended to go hiking but it was windy so I ended up staying home.
전화를 하려다가 문제 생겨서 여유 시간이 없었어요.
Something came up when I was going to call you, and then I didn't have time to spare.
오늘 아침에 운동을 하려고 했는데 너무 피곤해서 결국 늦잠을 잤어요.
I was going to work out this morning, but I was so tired that I eventually overslept.
택시를 타려다가 길이 막혀 회의에 늦을까봐 지하철을 타게 되었어요.
I was going to take a taxi, but I got on the subway because there was a traffic jam and I was afraid I would be late.
수업을 들으려다가 친구가 도움을 구해서 결국 친구의 집에 가게 되었어요.
I was going to take a class, but my friend asked for help and ended up going to my friend's house.
지하철을 타려다가 회의에 늦어서 택시를 타게 되었어요.
I was going to take the subway, but I was late for a meeting, so I took a taxi.