In SU(2)_{L}\times U(1)_{Y} theory, we have two coupling constants g_{L} and g_{Y}, and four MASSLESS gauge fields: W_{\mu}^{a}, \ a = 1,2,3 and B_{\mu}. We can redefine these fields by introducing two electrically charged fields
W^{\pm}_{\mu} = \frac{1}{\sqrt{2}}( W^{1}_{\mu} \mp i W^{2}_{\mu}),
and two neutral fields
Z_{\mu} = W^{3}_{\mu}\cos \theta - B_{\mu} \sin \theta
A_{\mu} = W^{3}_{\mu} \sin \theta + B_{\mu} \cos \theta
We still have no photon in here, because the gauge group is not U(1)_{em}, all fields are still massless and (more important) the two couplings g_{L} and g_{Y} are unrelated.
To break SU(2)_{L}\times U(1)_{Y} down to U(1)_{em}, we need to introduce a set of scalar fields \Phi which has U(1)_{em} invariant non-zero vacuum expectation value < \Phi > = v, i.e. it vanishes under the action of the U(1)_{em} generator (the electric charge)
Q_{em}< \Phi > = 0. \ \ \ \ (1)
Next, we introduce a small perturbation H(x)/ \sqrt{2} around the VEV of the scalar field < \Phi >. This will provides masses to ALL four gauge fields W^{\pm}_{\mu}, Z_{\mu} and A_{\mu}. So, in order to satisfy eq(1) one of the neutral fields must remain massless, so that it can be identified with the gauge field of the (unbroken) U(1)_{em} group, i.e. the photon. This happens for A_{\mu} provided that we CHOOSE the couplings such that
g_{Y} = g_{L} \tan \theta .
Sam