Elementary answer (for students who have not yet formalized the indefinite integral as a set of function or as a definite integral with variable upper limit):
(1) The basic rules for indefinite integrals that the students are used to are:
- $\displaystyle\int cf(x)\,dx=c\int f(x)\,dx$
- $\displaystyle\int [f(x)+g(x)]\,dx=\int f(x)\,dx+\int g(x)\,dx$
- $\displaystyle\int k\,dx=kx+C$ ($k$ constant)
Therefore,
$$\int f(x)\,dx-\int f(x)\,dx=\int f(x)\,dx+\int -f(x)\,dx=\int [f(x)-f(x)]\,dx=\int 0\,dx=C.$$
In other words:
In the context of operations with indefinite integrals, $\int f(x)\,dx-\int f(x)\,dx$ is not zero, but $C$ (constant).
This is generally not discussed because this expression rarely appears.
(2) If we look at the derivation of the integration by parts formula, we see that the correct formula is
$$\int u\,dv=uv-\int v\,du+C.$$
Usually, the $C$ is omitted because it is written after the calculation of $\int v\,du$ (formally, there would be two constants that are written as a single one). But since in your case $\int v\,du$ was not calculated, $C$ cannot be omitted.
(3) Putting these things together, the correct reasoning would be
$$\int \frac{1}{x}dx = \int \frac{1}{x}dx -1+C_1$$
$$\int \frac{1}{x}dx - \int \frac{1}{x}dx= -1+C_1$$
$$C_2= -1+C_1$$
This just gives us a relationship between the arbitrary constants coming from (1) and (2) for the particular case considered.