I am following Ordinary differential equations by Tenenbaum.
Page 48
The differential is defined as: $$dy(x,\Delta x) = f'(x) \Delta x$$
Note: we will want to apply this definition to the function defined by $y = x$. Therefore, in order to distinguish between the function defined by $y = x$ and the variable x, we place the symbol $\hat{}$ over the x so that: $y = \hat{x}$ will define the function that assigns to each value of the independent variable x the same unique value to the dependent variable y.
(in a Cartesian plane a horizontal line?)
Theorem 6.2 If,
$$y = \hat{x}$$ then $$dy(x,\Delta x)= (d\hat{x})(x,\Delta x) = \Delta x$$
Straight after this comes the thing I do not clearly understand, the book says:
Comment 6.3: Replace the value found for $\Delta x$ (from theorem 6.2) in the definition of differential, we obtain: $$dy(x,\Delta x)= f'(x)(d\hat{x})(x,\Delta x) $$
... this relation is the correct one, but in the course of time, it became customary to write it down in the familiar form: $$dy = f'(x)dx$$
The book then proceeds to use this formula (that I know is correct) in any case.
But wouldn’t this formula be only relevant in the case $y = \hat{x}$ since it was found relying on theorem 6.2 that is only valid if $y = \hat{x}$?
This is something I would call "silly notation." This is, in essence, a reference to differential geometry.
Usually, in undergraduate math, a vector only signifies "magnitude and direction." In differential geometry, a "tangent vector" is a vector directed from a fixed point. Differentials (or, in snazzy terms, "differential 1-forms") are then interpreted as functions of these tangent vectors.
In this case, if we let $\vec{v}_x$, where $x$ is a real number and $\vec{v}=\Delta x$ (so that $\vec{v}$ is a vector pointing from $x$ with magnitude and direction $\Delta x$), $$\mathrm{d}y(\vec{v}_x)=\mathrm{d}f(\vec{v}_x)=f'(x)\,\mathrm{d}x(\vec{v}_x)=f'(x)\Delta x.$$
You can find a nice introduction, which I think most undergraduates that have taken a strong set of courses in calculus will be able to work through, in Michael Spivak's Calculus on Manifolds. This also applies for "$u$-substitution," since, if we use differential forms, substitution (or change of variables in general) can be stated simply as, for $f:M\to N$ an orientation-preserving diffeomorphism, $$\int\limits_{N}\beta=\int\limits_{M}f^*\beta,$$ where $\beta$ is a differential form and $f^*\beta$ is the pullback of $\beta$ by $f$.