Answer
$$ y(x)=\tanh x+3 \operatorname{sech} x$$
Work Step by Step
Given$$y^{\prime}+(\tanh x) y=1, \quad y(0)=3$$
This is a linear equation with $p(x) =\tanh x\ \ q(x) =1$, so
\begin{align*}
\mu(t)&=e^{\int p(x)dx}\\
&=e^{\int \tanh x d x}\\
&=e^{\ln \cosh x}\\
&=\cosh x
\end{align*}
Then
\begin{align*}
y\mu(x) &=\int \mu(x)q(x)dx\\
\cosh x y &=\int \cosh x dx\\
&= \sinh x+C
\end{align*}
Then $$y(x)=\tanh x+C \operatorname{sech} x$$
Since $y(0)=3 $, then $C=3$, and hence
$$ y(x)=\tanh x+3 \operatorname{sech} x$$