LM386 speaker distorts
Compare your circuit with an example from the datasheet:




You have the + input grounded rather than the - input as in the datasheet.  The LM386 only works properly when the - is grounded and signal goes in the +.  You have the connections to pin 2 and pin 3 swapped.
You have some strange feedback from the output to the gain input.  Don't do that.  The gain pins should only be connected together (through a capacitor or a capacitor in series with a resistor.)  Remove R18 and C9.




The LM386 is not an opamp.  It is a power amplifier whose symbol happens to resemble that of an opamp.

It doesn't work like an opamp, and you can't treat it as one.