self-adjoint form
Why do the eigenfunctions of one differential operator come out orthogonal while another's do not? The deciding feature is a structural symmetry called self-adjointness — the differential-equation analogue of a symmetric matrix. A symmetric matrix is guaranteed real eigenvalues and orthogonal eigenvectors; an operator written in self-adjoint form inherits the same guarantees. Self-adjoint form is simply the special way of writing a second-order operator that makes this symmetry visible.
An operator is in self-adjoint form when it reads L[y] = (d/dx)(p(x) dy/dx) + q(x) y — note the derivative term is packaged as one exact derivative of p times y'. A general operator a(x) y'' + b(x) y' + c(x) y usually is not in this shape, but you can always force it there: multiply the whole equation by the integrating factor mu(x) = (1/a) exp(integral of (b/a) dx), and the first two terms collapse into (d/dx)(p y') with p = mu a. The pay-off is that, under suitable boundary conditions, integrating L by parts twice moves the operator from one function to the other with no leftover boundary terms — the formal statement integral of u L[v] dx equals integral of v L[u] dx. That symmetry is exactly what forces real eigenvalues and orthogonality.
In practice you almost never solve an applied eigenvalue problem without first putting it in self-adjoint form, because only then is the weight function w(x) unambiguous and only then do the orthogonality integrals carry the correct weight. The Legendre, Bessel, Hermite, and Laguerre equations all become self-adjoint after the right multiplier, which is precisely why their solutions are mutually orthogonal families and can be used as expansion bases.
Bessel's equation x^2 y'' + x y' + (x^2 - n^2) y = 0 is not self-adjoint as written. Divide by x and recognize the multiplier: it becomes (d/dx)(x y') + (x - n^2/x) y = 0, i.e. self-adjoint with p = x, q = -n^2/x, and weight w = x.
The weight w = x that appears here is exactly the weight under which Bessel functions of different scaled arguments are orthogonal.
Self-adjoint form is a property of the operator together with its boundary conditions: even a self-adjoint differential expression can fail to give orthogonality if the boundary terms from integration by parts do not vanish.