Can two waves (like sound or electromagnetic waves) interfere head on? If yes, and suppose they are out of phase with each other and thus interfere destructively, where does the energy of the waves go?
Can two waves (like sound or electromagnetic waves) interfere head-on?
Yes. When waves add in a superposition it is called interference. Two waves heading towards each other with have interference.
suppose they are out of phase with each other and thus interfere destructively, where does the energy of the waves go?
It depends on what you mean by "interfere destructively". If you mean at some point in time the amplitude is $0$ for all points in space, then there isn't a problem. The wave equation is a second-order equation, so the wave is not only determined by its amplitude. A simple example is seen with waves on a string. Send one pulse to the right and another opposite pulse to the left on the string. When they meet the amplitude of the superposition is $0$ at all points on the string for that instant in time. But the various parts of the string still have a velocity, and hence the two pulses will then move past each other. No energy is lost.
If instead, you mean can we have two waves approach each other so that for all times larger than some finite time the superposition is $0$, then this is impossible? This assumes that we have two non-zero waves with some sort of localization in space. These waves will eventually move past each other. Even if you had a continuously oscillating source you couldn't cancel everything out. Of course, your energy conservation argument is sufficient as well in my opinion.
Two waves of the same frequency and oppposite direction of propagation will produce a standing wave.
Like this figure by LucasVB:
Edit: In a standing wave, the energy oscillates back and forth between different forms. For a mechanical wave (transverse wave on a string for example), that is elastic potential energy and kinetic energy. At instances when the string is straight (minimal potential energy), the kinetic energy is at its maximum.
For sound waves and other waves that depend on the motion of atoms and molecules, destructive interference will eventually disperse the energy to the atoms and molecules finally ending up in heat (motion of matter).
For light, which does not depend on a medium to propagate, it is more complicated. Light only superimposes, does not interact. This MIT video shows what is happening in superposition interference of a laser beam split in two and made to interfere. The energy not appearing in the pattern goes back to the lazing mechanism!
In general for electromagnetic waves, when interference light patterns are seen, the energy goes from the dark regions to the bright regions, i.e.it is a function of at least two spatial dimensions, not the one-dimensional plots usually showing amplitudes interfering. In my answer here to an almost duplicate question, I go into more detail. Note that in order to see light, it has to interact with matter, so in the end, the energy will go into heating the screen material.
Of course annav's answer is right. Let me add a few things, because there are two basic theories:
in the double slit experiment, when we interpret the photon (shot one at a time) pass through both slits as partial waves, those waves interfere. They can interfere constructively (their in phase, create a dot on the screen) or destructively (out of phase and no dot on the screen). Of course the explanation here is that the photons, and the slits are entangled, and so the energy of the photons that interfere destructively, will give their energy to the slits as they scatter inelastically, or get absorbed by the slits. Energy is conserved. If they interfere constructively, the energy is in the dot on the screen. Energy is still conserved.
virtual particles and antiparticles, these are of course duo to wave-particle duality acting as waves too, and when they in your case interfere head on, they cancel out, and the energy goes to where it came from. Back to the vacuum energy density. Yes, photons are their own antiparticles. When you talk about elementary particles in the SM, particles can annihilate with their own antiparticles. This is what you are asking about, because in this case, when the particle antiparticle is created, it pops in and out of existence. From where? From the vacuum energy density (virtual particles).
Pair production is the creation of a subatomic particle and its antiparticle from a neutral boson. Examples include creating an electron and a positron, a muon and an antimuon, or a proton and an antiproton. Pair production often refers specifically to a photon creating an electron–positron pair near a nucleus. For pair production to occur, the incoming energy of the interaction must be above a threshold of at least the total rest mass energy of the two particles, and the situation must conserve both energy and momentum.
In particle physics, annihilation is the process that occurs when a subatomic particle collides with its respective antiparticle to produce other particles, such as an electron colliding with a positron to produce two photons. The total energy and momentum of the initial pair are conserved in the process and distributed among a set of other particles in the final state.
Now it is very important to understand that virtual particles are not real particles, and they can pop in and out of existence from the energy density of quantum vacuum. Virtual particles are a mathematical model of describing the interaction of quantum fields, in this case the poping of in and out of virtual particles.
This is not the case in pair production and annihilation. These are real particles. In the case of pair production and annihilation, and this is what you are asking about, two particles (particle antiparticle pair) is created or annihilated. When the particle and anti particle, like an electron and a positron, traveling as waves, collide head on, both cease to exist as fermions (or when the photon ceases to exist and creates a electron and positron), and the energy (momentum) transforms into a photon. So energy is conserved.