They used a product rule, quotient rule and chain rule, I won't be discussing the rules themselves as such topics belong to Mathematics.SE, but the reason why you might not realize this outright is the particular notation in a growth theory, which would be on topic here so I will focus on that.
In Solow growth model with labor augmenting technological change $f(k)$ is the production function expressed per 'effective worker' so:
$$f(k) = F \left(\frac{K}{AL},1 \right)$$
so you might as well rewrite the problem as:
$$d\left(AL F \left(\frac{K}{AL},1 \right) \right)/dL=A F \left(\frac{K}{AL},1 \right) +AL F '\left(\frac{K}{AL},1 \right) (−AK)/(LA)^2$$
Now we can cancel some terms and use the fact that $k =K/AL$:
$$A F \left(\frac{K}{AL},1 \right) + F' \left(\frac{K}{AL},1 \right) (−K)/(AL)=A F \left(\frac{K}{AL},1 \right) -A k F' \left(\frac{K}{AL},1 \right) $$
Now finally go replace the $ F \left(\frac{K}{AL},1 \right)$ back with $f(k)$ so you get:
$$A F \left(\frac{K}{AL},1 \right) - Ak F' \left(\frac{K}{AL},1 \right) =A f(k) -Ak f'(k) = A(f(k) -k f'(k)) $$
So it is all about paying attention to what different definition of the arguments used here are. If you can't follow the differentiation itself that is question for Mathematics.SE or just further self study (Essential Mathematics for Economic Analysis by Sydsaeter covers all you need for this sort of problem).