On why we have $dy = f'(x)dx$? 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}$?
 A: 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$.

As to the specific question of whether the construction given works only for $y=\hat x$, the answer is no. Since $x=\hat x$ by definition, their differentials are the same. The $y$ in the given formula is not the $y=\hat x$.

A: The problem stems from using two different letters, namely $y$ and $f$, for the same object.
For an arbitrary function $f$ we have
$$df(x).\Delta x=f'(x)\>\Delta x,\tag{1}$$
because
$$f(x+\Delta x)-f(x)=f'(x)\>\Delta x + o(|\Delta x|)\qquad(\Delta x\to0)\ .$$
When $f$ is the identity function $\hat x:\>x\mapsto x$ on ${\mathbb R}$
we have
$$\hat x(x+\Delta x)-\hat x(x)=\Delta x + 0\qquad(\Delta x\to 0)\ ;$$
whence
$$d\hat x(x).\Delta x=\Delta x\qquad\forall x\in{\mathbb R}, \ \forall \Delta x\in{\mathbb R}\ .$$
Comparing with $(1)$ we see that the following is true:
$$df(x).\Delta x=f'(x)\ d\hat x.\Delta x\qquad\forall x\in{\mathbb R}, \ \forall \Delta x\in{\mathbb R}\ .$$
The last equation says that the two functions (of two variables!) $df$ and $d\hat x$ are related by the equation
$$df=f'(x)\>d\hat x$$
(note that $f'(x)$ is a scalar here). When we omit the hat and use $x$ not only for variable points on ${\mathbb R}$, but as well as name for the identity function on ${\mathbb R}$, we obtain the famous relation
$$df=f'(x)\>dx\ .$$
This is not an obscure relation between infinitesimals, but the expression of $df$ as a scalar (depending on $x$) multiple of $dx$.
