Let $g(x)$ be a polynomial of degree $d$ and $h(x)$ be a polynomial of degree $l$ over field $F$. If $\deg(\gcd(g,h)) > 0$ then there exist two polynomials $a(x)$, $b(x)$ of degrees $< l,d$ respectively such that $a(x)g(x) + b(x)h(x) = 0 $ and conversely.
By using extended Euclidean we can say that if $\deg(\gcd(g,h)) > 0$ then there exist two polynomials $a(x)$, $b(x)$ of degrees $< l,d$ respectively such that $a(x)g(x) + b(x)h(x) = \gcd(g,h)$. I am not getting how it is $0$. And the second thing is how to prove the second direction.
Reference : http://www.math.rutgers.edu/~sk1233/courses/ANT-F14/lec10.pdf (4th Page)
It's a dimension counting exercise. Write $F[x]_d$ for the space of polynomials of degree at most $d$. Then $(a,b)\mapsto ag+bh$ is a linear map $F[x]_{l-1}\times F[x]_{d-1}\to F[x]_{l+d-1}$. Note carefully that the two spaces have the same dimension, so the map is onto if and only if it is injective.
I'll let you try to finish it yourself.