Can someone explain why the formula below is a definition of the Dirac function?
$$\int_I y(0) \delta(t)\, dt =\begin{cases} y(0) \text{ if 0}\in \text{I} \\\\ 0 \text{ otherwise} \end{cases}$$
where $I$ is an interval.
I am used to the definition $\int \delta(t) \,dt = 1$ and $\delta(t) = \infty$ if $t = 0$, otherwise $0$.
The definition you give ($\int \delta(t) dt = 1$ and $\delta(t) = \infty$ if $t = 0$, otherwise $0$) is more of a characterization its behavior, rather than a true definition.
Rewrite your expression as:
$$ \int_\mathbb{R} y(0) 1_I \delta(t)\, dt$$
where $1_I$ is the indicator function for I.
This integrand is a representation of $[(y\cdot 1_I) * \delta](0)$ where $*$ is a convolution. Because the dirac delta is the identity with respect to the convolution, this is equal to $[(y\cdot 1_I)](0)$; this is $y(0)$ if $I$ contains 0, or zero otherwise.