How can we taking derivatives on $UV$ w.r.t a vector $\mathbf{x}$ by using the chain rule and $d(UV)=dU\cdot V + U\cdot dV$?
Because of the nature of the cost function, we can reason on a single component and sum everything at the end. The differential readily writes $$ d\phi = \frac{-df_n}{f_n} $$
Introducing the gradient column vector $\nabla f_n(\mathbf{x})$ , we can write $ df_n = (\nabla f_n)^T d\mathbf{x} $.
The gradient is thus $$ \mathbf{g} = \frac{\partial \phi}{\partial \mathbf{x}} = \frac{-1}{f_n} \nabla f_n (\mathbf{x}) $$
Introducing the Hessian matrix $d\nabla f_n = \mathbf{H}_{f_n} d\mathbf{x}$, it follows that \begin{eqnarray*} d\mathbf{g} &=& \frac{df_n}{f_n^2} \nabla f_n (\mathbf{x}) -\frac{1}{f_n} (d\nabla f_n) \\ &=& \frac{1}{f_n^2} \nabla f_n (\mathbf{x}) (\nabla f_n)^T d\mathbf{x} -\frac{1}{f_n} \mathbf{H}_{f_n} d\mathbf{x} \end{eqnarray*} The Hessian is thus $$ \mathbf{H}_\phi= \frac{1}{f_n^2} \nabla f_n (\mathbf{x}) (\nabla f_n)^T -\frac{1}{f_n} \mathbf{H}_{f_n} $$