The fallacious step is the one where you forgot that $\int \tan(x)\,dx$ is an equivalence class or family of functions.
In other words, the problem $f(x) = \int \tan(x)\,dx$ has a solution set
consisting of infinitely many functions that might be named $f$ in that equation.
Every function in the solution set has the form
$$ f(x) = \log(\cos (x)) + C $$
where $f$ is a function over the interval $(-\pi/2,\pi/2)$
and $C$ is some constant.
The difference $A - B$ when $A$ and $B$ both are equivalence classes consists of all possible values $a - b$ where $a \in A$ and $b \in B.$
Therefore,
$$ \int \tan(x)\,dx - \int \tan(x)\,dx =
\{f: (-\pi/2,\pi/2)\to\mathbb R\mid
(\exists c\in\mathbb R)(\forall x\in\mathbb R) f(x) = c\},$$
that is, the difference of the two integrals is the set of
all real-valued constant functions over the same domain as
$\int \tan(x)\,dx,$
because for any real number there is some member of $\int \tan(x)\,dx$
that you can subtract from another member of $\int \tan(x)\,dx$
to get the desired number as your difference.
Now it is certainly true that there are constant functions
$C_1$ and $C_2$ such that
$$ C_1 = -1 + C_2,$$
but it is not true that both of those functions will always be the
zero function, and you cannot conclude that $0 = -1.$
If all this talk of equivalence classes is too much,
you can just remember to add the constant of integration everywhere
you use an indefinite integral.
Also make sure that if you have two integrals, each one gets its own constant of integration, even if they are integrals of the same integrand.
You can replace the sum or difference of two constants of integration
by a new constant, but you cannot assume their difference is zero.