Theta in hypothesis and gradient function

In gradient function theta is not initialised but passed to get the value of hypothesis and in hypothesis function y_ is dependent on theta.
I am not able to understand how hypothesis and gradient is being calculated?