There's a few things going on here.
Global vs Gauge Symmetries
First, it's true that $SU(2) \sim SO(3)$ if you only worry about small rotations. The more precise statement is that $SU(2)$ is the "double cover" of $SO(3)$, so you can think of $SU(2)$ as two copies of $SO(3)$ that are glued together in a particular way. The "number of states" you're referring to in your post is the number of spin states. Every particle has a spin because every particle exists in space. Spin captures what happens when you rotate a particle in space. If you know what happens to a particle for small rotations, you know what happens for big rotations, because a big rotation is just a lot of small rotations put together. Therefore, information about spin is captured by $SU(2)$ transformations.
A completely unrelated phenomenon is that a particle can have a charge under a force. It turns out that charge is deeply related to group theory (see the next section) and hoe particles transform under different group transformations. So particles not only need to know how they transform under physical rotations, they need to know how they transform under the more abstract "gauge transformations" associated with the various forces of nature. These are two separate pieces of information, and particles need to have the complete list for all the relevant forces of nature.
In our universe, the relevant gauge groups are $SU(3),SU(2), U(1)$ for the strong, weak, and electromagnetic forces. The $SU(2)$ for the weak force is completely unrelated to the $SU(2)$ for spin.
Representation Theory
There's a difference between a symmetry group and the matrices we use to apply that symmetry to various vector spaces. In other words, there's a difference between abstract rotations and rotation matrices. The study of the difference between the two is called representation theory.
The $N$ is $SU(N)$ tells you the smallest dimensional vector space that $SU(N)$ can act on in a non-trivial way. This "smallest non-trivial vector space" is called the fundamental representation.
To explain why the photon still uses $SU(2)$ for rotations despite having three states, we first need an example of a different representation. This will be a little technical, but bear with me if you want to understand that point. Recall that any unitary matrix has eigenvalues that are a pure phase. This implies we can rewrite them as $$U = \exp(i \alpha_a T^a)$$ where $\alpha_a$ is a list of numbers and $T^a$ is a different set of matrices that, when exponentiated, always give the usual $N \times N$ unitary matrices. They are basically the Pauli matrices for more general groups. How many $T^a$s are there? $N^2-1$, because that's the dimension of the group. So you can think of $\alpha_a$ as being a vector in a $N^2-1$ dimensional space. And this space has an action of $SU(N)$ because if you conjugate $U$ by a different unitary $V$, $$ U' = VU V^\dagger = \exp(i\alpha'_a T^a)$$ so the $N^2-1 \times N^2-1$ matrix which transforms $\alpha \to \alpha'$ is also a representation of $SU(N)$, not $SU(N^2-1)$. If it was $SU(N^2-1)$, then you should be able to act by ANY unitary. But you can't: only a $N$ dimensional subspace of them. Finally, notice that $2^2-1=3$, so photons transform under precisely this representation of $SU(2)$, which is called the adjoint representation.
The last thing I'll say is that "how a particle transforms under a group" is the same thing as "what representation of the group is the vector space the particle lives in transforming under". So for a gauge symmetry, the charge of a particle is the representation it transforms under. I strongly recommend learning more about representation theory if you want to learn particle physics more deeply, because it's kind of the language that everyone uses and is really useful in describing stuff.