I have a confusion as to why this is a viable procedure in the following image:
$$ \sum_{n} B_n \int_{0}^{a} \sin \left( \frac{n \pi x}{a}\right) \sin \left( \frac{m \pi x}{a}\right) = \sum_{n} B_n \left( \frac{a}{2} \right) \delta_m = \frac{a B_m}{2} $$
To my knowledge (which is likely the thing that needs to improve here), sine orthogonality can be applied when integrating $sin(m k x) sin(n kx)$ over a full period (where $m, n$ are integers, and $k$ is a wavenumber, where $k = \frac{2\pi}{\lambda}$), not half of one.
Here the period is clearly $2a$, so why is this permissible as well? It seems I don't know when and when I can't apply sine orthogonality given certain limits of integration and wavenumbers.
Your eigenfunctions are solutions of $$ y''+\lambda y = 0,\;\;\; 0 \le x \le a \\ y(0) = 0,\;\; y(a)=0. $$ That is, $y_n(x)=\sin(n\pi x/a)$ for $n=1,2,3,\cdots$ are the solutions where $\lambda_n=n^2\pi^2/a^2$. These are automatically orthogonal because of the selfadjoint nature of this ODE. And they form an orthonormal basis of $L^2[0,a]$.
Likewise, $y_n(x)=\cos(n\pi x/a)$ for $n=0,1,2,3,\cdots$ are solutions of $$ y''+\lambda y= 0,\;\;\; 0 \le x \le a \\ y'(0)=0,\;\; y'(a)=0 $$ So these functions also form an orthogonal basis of $L^2[0,a]$.
There are also orthogonal bases of $\sin$ functions with non-harmonic arguments that form an orthogonal basis. For example, consider the more general problem $$ y''+\lambda y = 0,\;\;\; 0 \le x \le a \\ y(0)=0,\;\;\; Ay(a)+By'(a)=0. $$ The functions $\sin(\alpha_n x)$ are solutions where $$ A\sin(\alpha_n a)+B\alpha_n\cos(\alpha_n a)=0 $$ The solutions $\alpha_n$ are not evenly spaced, but the corresponding $\sin(\alpha_a x)$ are mutually orthogonal.