By definition!
Photons are by definition the single component of the original \(SU(2)\times U(1)\) electroweak gauge field that leaves the Higgs vacuum expectation value invariant. This means that the VEV is uncharged for the photon, and the photon aquires no mass.
A little simpler: basically, \(SU(2)\times U(1)\) is a four dimensional group of transformation. The Higgs is a field which takes value in a four-dimensional (two-complex dimensional) vector space and which is transformed ("rotated") by these transformations. Now after electroweak symmetry breaking the Higgs aquires a VEV, which just mean that in all of space it assumes the value of a specific vector in that 4-dimensional space. This vector is not invariant under the original gauge group, this means that it breaks the symmetry. There is however a 1-dimensional subgroup of the gauge group that still leaves the VEV invariant and thus that symmetry remains unbroken. That group's generator is defined to be the photon and the preserved gauge symmetry assures the photon has no mass. The other three generators instead do interact with the VEV and acquire mass. They are decomposed in three orthogonal generators by electric charge: \(W^+\), \(W^-\), \(Z^0\).
And now, more detailed: assume WLOG that the Higgs has VEV as such:
\[ \phi = \begin{pmatrix} 0 \\ \phi_0 \end{pmatrix} \]
with \(\phi_0\) real, and the generic gauge group element acts on \(\phi\) as
\[ \phi \rightarrow \exp\left(i \left(\frac{g'}{2} B \cdot \mathbb{1} + g W_1 T^1 + g W_2 T^2 + g W_3 T^3\right) \right) \phi\]
Where \(B\) and \(W_i\) are respectively the gauge field for weak hypercharge (\(U(1)\)) and weak isospin (\(SU(2)\)), \(T^i= \frac{\sigma^i}{2}\) are generators for \(SU(2)\), and \(g\), \(g'\) are the corresponding coupling constants.
We impose \(\phi' = \phi\) to find the little group of the VEV (the isotropy group). For infinitesimal generators, the above reduces to:
\[ \begin{pmatrix} g'B + g W_3 & g (W_1 + i W_2) \\ g (W_1 - i W_2) & g'B - g W_3 \end{pmatrix} \begin{pmatrix} 0 \\ \phi_0 \end{pmatrix} = 0 \]
This gives immediately \(W_1 = W_2 = 0\) (as they are real generators) and \(g'B - g W_3 = 0\); this means that the generator \(A = \frac{1}{\sqrt{g'^2+g^2}} (g' W_3 + g B)\) solution to the latter two equations generates the one-dimensional isotropy group. This generator is the photon.
The other three generators do modify the value of the Higgs and are orthogonalized into the $W^{} = (W_1 i W_2) $ and $Z^0 = (g W_3 - g' B) $.
The mass generation is evidenced by expanding the kinetic term of the Higgs Lagrangian around the VEV. This gives a mass term for the gauge boson which is precisely the norm squared of $( B + g W_i T^i )$. Therefore the orthonormal states \(A\), \(W^{\pm}\), \(Z^0\) above diagonalize the mass matrix, and \(A\) is the single one with eigenvalue \(0\), as was shown before.