What category is the universal property of the Free Group a diagram in?
As you say, $S$ is a set, so this is a diagram in $\text{Set}$. The fact that we force $\varphi$ to be a homomorphism of groups is extra structure that isn't captured by the diagram alone.
You might consider this unsatisfying, so alternatively we can explicitly name the forgetful functor $U : \text{Grp} \to \text{Set}$ from groups to sets, which is being implicitly applied to $G$ here, and regard $f$ as a morphism $f : S \to U(G)$ in $\text{Set}$, then talk about the universal property in terms of the adjunction
$$\text{Hom}_{\text{Grp}}(F(S), G) \cong \text{Hom}_{\text{Set}}(S, U(G)).$$
As the definition mentions, $f$ and the unnamed inclusions are just functions while $\varphi$ is a group homomorphism. Hence the diagram is not in $\mathbf{Grp}$, nor actually in $\mathbf{Set}$ (in the sense that the diagram in $\mathbf{Set}$ would not force $\varphi$ to be a group homomorphism).
The construction gives in fact a functor from $\mathbf{Set}$ to $\mathbf{Grp}$ assigning to each set $S$ the free group $F_S$, and to each function $g:S\to T$ the morphism $\varphi_g:F_S \to F_T$ associated to the map $f=\iota_T\circ g:S\to F_T$ by the universal property (where $\iota_T:T\to F_T$ is the inclusion).
I often think of the free group over $S$ to be the initial object in the category of groups with $S$ specified points, or more formally the category of groups $(G, *)$ along with a specified function from $S$ to $G$, where morphisms consist of a group homomorphism that makes the functions from $S$ agree.
This definition captures what the diagram is trying to convey: it is showing initiality of $F_S$ where the morphism consists of the whole wedge coming out of $S$.
As other answers have said, this construction results in a functor from $\mathbf{Set}$ to $\mathbf{Grp}$, which is left adjoint to the forgetful functor, but I don't believe this context (while fascinating, and points to many interesting generalizations) is necessary to understand the free group.