Can you help me with how Professor Ng came about with the equation above?

Hey,

he is just trying to refer the whole term with dw1 (which is specific to x(i), y(i))

Yes, indeed. He is simply introducing the differential notation dw for the partial derivative function of the loss function, which as @reshu points out, depends on x^{(i)} and y^{(i)}.