1) There was mould on the connection top of the keg when you bought it.
If the connection top was covered with mould when you bought the keg, you should not use it. Take the keg back to the shop where you bought it and use a new keg.
2) The parts of the appliance have not been cleaned correctly.
Always unplug the appliance before cleaning it. Clean the outside of the appliance with a damp cloth. Remove the spout. Remove and disassemble the drip tray and the drip tray cover. You can remove the tap handle by pulling it out of the tap body. Clean the spout, the drip tray cover and the tap handle with hot water and some washing-up liquid. The drip tray, the drip tray cover and the spout are dishwasher-proof. The tap unit is NOT dishwasher-proof and should be rinsed with hot water. Clean the connection top of the keg with water or a clean towel.