Informally we get $f(a)$ from the integral as follows.
Consider the curve $f(x)$ weighted (multiplied by) the delta function in a small vicinity of the point $a.$ However we define the delta function, it is essentially an impulse (a narrow rectangle or triangle or gaussian) of unit area. As the rectangle gets very narrow it grows taller, preserving unit area. In a sense it ulimately picks out the valus of $f$ in a very small interval about $a,$ $[a+\epsilon,a-\epsilon],$ multiplying that value by one.
Since the delta function is zero outside this narrow range, there is no need to worry about the function elsewhere.
Note: In Dirac's 'Quantum Mechanics' p. 58 ff. the author goes to some trouble to explain the delta function and show its utility in QM. This I think supports that the question is properly in the ambit of physics as well as mathematics.