Why is there a resistor and a capacitor in this AUX cable's diagram?

Audio signals do not have a DC components, but some devices add DC to the output, either as artifact, or because the circuit is more simple if you allow some residual DC. On the other hand, the amplifier in your car might expect a DC-free signal at its input. The capacitors serve as protection against bad devices outputting DC.

Typically, the output impedance of an AUX connector is around 5 to 10 kiloohms, and the output impedance of headphone jacks is between 20 and 200 ohms. Both of these are way below the 300 kiloohm resistor, so it appears electrically as if the resistor was not there if both the left and right channel are properly driven. You likely never notice the small amount of stereo mixing that is caused by this resistor except with special test signals. On the other hand, if a mono source is connected to only one of the input channels, and the other channel is left open, the resistor transfers the audio signal to the unconnected channel. If the input impedance of the amplifier is high (several mega ohm are likely if they use a FET buffer amplifier in the input stage), the 300 kilo ohm resistor will not reduce the volume a lot. The R-C combination will cause a slight frequency dependent phase shift, which is not a completely bad idea, because it makes the sound less mono-like and more appealing to the casual listener.

So the capacitors are a fix for bad devices that output DC on their jack, and the resistor is a fix for (bad) devices that do not output a stereo signal. I can't explain why they put these fixes into the cable and not the input circuit if the car amplifier.

The capacitors AC-couple B1 to X13598, effectively removing any DC bias on those audio lines. The resistor is probably in place for impedance matching the source.

To further elaborate, capacitors have a lower impedance (or reactance) at higher frequencies. To AC signals, they look almost like a short circuit. To DC they look almost like an open circuit. It is possible that they are not using a bipolar output, and thus the capacitors could remove the DC offset, effectively making the signal bipolar.

BMW radio uses the resistance between Left and Right to determine whether to make aux available. To ensure all devices work correctly, you should have it. The effect of no resistor might be desirable to you, or not: if you remove the cable from your device (e.g. iPhone) then the radio jumps out of Aux input back to Radio (e.g. FM). Drives me nuts, am going to add the resistor.