If $x$ and $y$ are independent, the differential form $\cos(x) \mathrm{d}y$ is not an exact form; this means it does not have an antiderivative.
For comparison, the form $\cos(x) \mathrm{d}y - y \sin(x) \mathrm{d}x$ is exact, and one of its antiderivatives is $y \cos(x)$. And note that
$$ \mathrm{d}\left( y \cos(x) \right) = \cos(x) \mathrm{d}y - y \sin(x) \mathrm{d}x $$
will remain true even if $x$ and $y$ are not independent.
However, $\cos(x) \mathrm{d}y$ it can have an antiderivative if we force a dependence. The most pertinent is:
If $x$ is held constant, then $\cos(x) \mathrm{d}y$ has antiderivatives $y \cos(x) + g(x)$, where $g$ is any function of $x$.
It's the antiderivative because, if $x$ is held constant, then $\cos(x)$ and $g(x)$ are also constant and their derivatives are zero.
Typically, if $x$ and $y$ are independent variables that you are expressing things in terms of, then this is what is intended by the expression $\int \cos(x) \, \mathrm{d}y$; this is partial antidifferentiation, and is the inverse of the partial derivative with respect to $y$. (both meant as $x$ held constant)