Hello, fellas. On August 2, 2018, we learned how to reduce adverb clauses of time. There are two ways of reducing the adverb clause of time: (1) omit the subject and be (if any); or (2) if there is no be, omit the subject and change the verb to its –ing form. However, there are still other ways of the reduction.
(More on reduced adverb clauses of time: https://englishtips4u.com/2018/08/02/grammartrivia-reduced-adverb-clauses-of-time/)
If a sentence begins with an –ing form, it may be due to the reduction of an adverb clause of time using while, expressing the idea of “during the same time”.
While I was walking to school, I witnessed a car accident.
Walking to school, I witnessed a car accident.
An adverb clause of time beginning with when can also be shortened to upon/on + -ing.
When I finish my study, I will come back to Indonesia.
Upon finishing my study, I will come back to Indonesia.
On finishing my study, I will come back to Indonesia.
Betty Schrampfer Azar, Understanding and Using English Grammar: Third Edition