Indeed, there is deep theory involved behind all of this. When you learn more about inner product/Hilbert spaces, you will see spaces that have a certain operation on them called an inner product whose axioms/properties you can find in the link. These spaces are interesting because inner products give us a sense of "angle" or "direction" (note how its properties generalize the dot product of Euclidean space). Further, we can define a norm on that space with this inner product: $ \|x\| = \sqrt{\langle x,x \rangle}$ and then this norm gives us an idea of the "length" of a vector in this space.
Then we define a metric on this space with $ d(x,y) = \|x-y\|$ and this metric gives us an idea of distance between two points (which leads us to think about convergence of sequences and other analysis-type questions). This metric also then allows us to generalize open sets which endows a sense of whether some points are "close together" or "split apart", and these open sets then induce a topology, which allows us to study topological properties such as continuity and connectedness.
Clearly that is just an overload of new information, so you may wonder - what does it all mean? Well essentially each of these stages are abstractions that are structurally similar to the well known Euclidean space. Hilbert spaces are the most similar to $\mathbb{R}^n$ - in them we have all the ideas above, of angle, direction, magnitude of a vector, distance between vectors, neighbourhoods of vectors, and convergence of every Cauchy sequence. This is why Hilbert spaces are so interesting - we have plenty of intuition about how they should behave, they have enough structure on them to give us plenty of useful results, but they are general enough to be substantially different from $\mathbb{R}^n$.
One example of a Hilbert space is the Lebesgue square-integrable functions with the inner-product $\langle f,g \rangle = \int_X f\cdot \bar g\; \mathrm d\mu$, and you are considering one of them. The integral in your post corresponds to the inner product of this space (remember, this is the generalization of a dot product) and just as when the dot product of Euclidean vectors was $0$ we declared them orthogonal, we do the same here. As anon commented, when two functions are orthogonal they are linearly independent, which is a familiar property. If you have enough linearly independent vectors chosen wisely to form a basis, we should be able to form any vector in this space as a linear combination of the basis vectors - that is a Fourier series.
I'm not an expert in the history of ring theory but this is, I think, pretty close to a correct answer:
You are right that the notion of "prime integer" predates the more general notions of "prime element" and "irreducible element" in an arbitrary ring. In fact, prime numbers go back to ancient Greece! But there is a missing link in the evolution of that original notion into the (two distinct) modern notions: namely, the notion of a prime ideal.
Ideals were regarded as a kind of "generalized number"; in fact, the original terminology was "ideal number", only later shortened to "ideal". One ideal $I$ was said to divide another ideal $J$ if and only if $J \subset I$. A prime ideal is then defined, in precise analogy with the "classical" definition of prime numbers (i.e. as indecomposables) to be an ideal that is not divisible by any ideals other than itself and the entire ring.
Once "prime ideal" was defined, the next development was to say that an element was prime if it generated a prime ideal. It is a fairly straightforward exercise to show that this translates directly to the modern definition of prime element. It is also fairly easy to show that (as long as there are no zero-divisors in the ring) every prime element is indecomposable in the classic sense. So everything fits together quite nicely.
It is only at this point that somebody starts looking at rings like $\mathbb{Z}[\sqrt{-5}]$, which are not unique factorization domains, and realizes that those rings can contain elements that are indecomposable in the classic sense, but do not generate prime ideals. Whoah! So we need a name for those types of elements. "Prime" is already taken, so they get called "irreducible".
So there you have it. The elements that we now call "irreducible elements", despite the fact that they have the property that we usually associate with "prime numbers", were not called "prime elements" because that word was already in use for elements that generate "prime ideals", which are defined in direct analogy with how we "usually" define prime numbers.
Best Answer
W.l.g is a reasonably common abbreviation for "without loss of generality" (used for assuming something without affecting the validity of the proof in general, usually because there are multiple, identical alternatives). Another common one is WLOG.