You can write is as
\begin{align*}
\int xd\left( f\left( x\right) \right) & =\int x\frac{df}{dx}dx\\
& =\int xf^{\prime}dx
\end{align*}
And Mathematica gives now
Integrate[x*f'[x], x]
I do not understand how Mathematica operates when Integrating with
respect to functions
It looks like you need to reformulate the command yourself like the above so that the integration is with respect to a variable and not a function.
I do not know why Mathematica gave the result it did with your input.
update
fyi, I tried this in Rubi, and Maple 20204 and Fricas and Maxima and XCas/GIAC. Out of these, maxima and giac returned back same result as Mathematica. This is the result
<< Rubi`
Int[x, f[x]]
Maple:
int(x,f(x))
Fricas:
>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.3, Release Date: 2024-03-19 │
│ Using Python 3.11.1. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: var('x')
x
sage: f=function("f",nargs=1)
sage: integrate(f(x),x, algorithm="fricas")
integral(f(x), x)
sage: integrate(x,f(x), algorithm="fricas")
Gives
TypeError: An error occurred when FriCAS evaluated 'integrate(sage4,sage3)':
Maxima:
sage: integrate(x,f(x), algorithm="maxima")
x*f(x)
Giac:
sage: integrate(x,f(x), algorithm="giac")
x*f(x)
Integrate[x, f[x]]==Integrate[x f'[x]],x]
$\endgroup$