When extremizing
$$I\left[y,\dot{y}\right]=\int\mathcal{L}(y,\dot{y},t)dt$$
One finds the difference between two near values and declares that the functional has been minimized when there is no change to first order. (assume fixed end points)
$$\Delta I\left[y,\dot{y}\right]=I\left[y+\delta y,\dot{y}+\delta \dot{y}\right]-I\left[y,\dot{y}\right]$$
$$\Delta I\left[y,\dot{y}\right]=\int(\mathcal{L}(y+\delta y,\dot{y}+\delta\dot{y},t)-\mathcal{L}(y,\dot{y},t))dt$$
Taking a taylor expansion of the integrand to first order, (note we will need to differentiate with respect to $\dot{y}$.
$$\delta I\left[y,\dot{y}\right]=\int(\delta y\frac{\partial \mathcal{L}}{\partial y}+\delta\dot{y}\frac{\partial \mathcal{L}}{\partial \dot{y}})dt$$
Integrating by parts (with vanishing boundary term)
$$\delta I\left[y,\dot{y}\right]=\int\delta y(\frac{\partial \mathcal{L}}{\partial y}-\frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot{y}})dt$$
Now if $\delta I=0$ for all admissible variations $\delta y$ then we have that the integrand must vanish identically
$$\frac{\partial \mathcal{L}}{\partial y}-\frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot{y}}=0$$