At first, you have
$$
\log L(\theta) = \log \left( \prod_{i=1}^m \left(h_\theta(x^{(i)})\right)^{y^{(i)}}\left(1 - h_\theta(x^{(i)})\right)^{1-y^{(i)}}\right)
$$
By the first equation, the product in the argument of $\log$ becomes a sum of $\log$s.
$$
\log L(\theta) = \sum_{i=1}^m \left( \log \left( h_\theta(x^{(i)})\right)^{y^{(i)}}\left(1 - h_\theta(x^{(i)}) \right)^{1-y^{(i)}}\right)
$$
But, again because of the first equation, you have that
In the end, you get
$$
\log L(\theta) = \sum_{i=1}^m \left( y^{(i)} \log (h_\theta(x^{(i)})) + (1-y^{(i)})\log\left( 1-h_\theta(x^{(i)})\right)\right)
$$
It uses the below logarithmic properties:
$(1) ~~~~~\log(a \cdot b) = \log a + \log b$
$(2) ~~~~~\log a^b = b \cdot \log a$
At first, you have $$ \log L(\theta) = \log \left( \prod_{i=1}^m \left(h_\theta(x^{(i)})\right)^{y^{(i)}}\left(1 - h_\theta(x^{(i)})\right)^{1-y^{(i)}}\right) $$ By the first equation, the product in the argument of $\log$ becomes a sum of $\log$s. $$ \log L(\theta) = \sum_{i=1}^m \left( \log \left( h_\theta(x^{(i)})\right)^{y^{(i)}}\left(1 - h_\theta(x^{(i)}) \right)^{1-y^{(i)}}\right) $$
But, again because of the first equation, you have that
$\log \left( h_\theta(x^{(i)})\right)^{y^{(i)}}\left(1 - h_\theta(x^{(i)}) \right) = \log\left( h_\theta(x^{(i)})\right)^{y^{(i)}} + \log \left( 1- h_\theta(x^{(i)})\right)^{1-y^{(i)}}$
And then, because of equation (2), you have
$\log\left( h_\theta(x^{(i)})\right)^{y^{(i)}} + \log \left( 1-h_\theta(x^{(i)})\right)^{1-y^{(i)}} = y^{(i)} \log (h_\theta(x^{(i)})) + (1-y^{(i)})\log\left( 1-h_\theta(x^{(i)})\right)$
In the end, you get $$ \log L(\theta) = \sum_{i=1}^m \left( y^{(i)} \log (h_\theta(x^{(i)})) + (1-y^{(i)})\log\left( 1-h_\theta(x^{(i)})\right)\right) $$