Your coffee machine can taste like chemicals when new as a result of the manufacturing process that uses chemicals in the plastics.
Another cause of a coffee machine that tastes like chemicals is a result of hard water that has high levels of magnesium and calcium which can cause a metallic or chemical taste in the coffee.
If your water is hard you can use a water softener or a water filter to mitigate the chemical taste in the coffee.
Also regularly descaling the coffee machine can help remove mineral buildup and prevent a metallic or chemical taste in the coffee.
Descale your machine regularly using a commercial descaling solution or a homemade vinegar solution to remove limescale buildup.
Additionally, clean your coffee grinder thoroughly to prevent the metal blades from heating up and contributing to the metallic taste.
Hard water, or water rich in minerals like calcium and magnesium, can impact the flavor of your brew, leading to a chemical or metallic taste.
Chlorine and other impurities in tap water can also contribute to the unpleasant flavors in coffee.
Limescale buildup in your coffee machine can also create a metallic, minerally flavor in the coffee.
If you've cleaned your coffee maker or coffee machine with vinegar that flavor can subsist for a long time, and if you haven't cleaned your coffee machine or coffee maker at all then mold can get into the works and really ruin the taste of your coffee.