Why do pickles taste sour if there dill and sweet when there bread and butter?
Bread and butter pickles contain sugar, where as dill pickles usually do not. The sourness comes from vinegar, which is used in both types.
Some pickles do not use vinegar, and the sour taste comes from natural fermentation (lactic acid).
Both of the above are correct! In naturally fermented pickles that don't use vinegar, the natural bacteria on the cucumbers' skin produces lactic acid, which is sour. In pickles made with vinegar, the sourness comes from the vinegar. Bread and butter pickles are just like dill pickles, but contain a much higher volume of sugar.