Diagnosis
That's a mix of old toothpaste, saliva, and water minerals building up in the handle's socket. It's common and can start to smell.
How to Fix It
Unplug the charger first. Take the brush head off. Use a dry toothpick or a pin to gently scrape around the inside of the socket, focusing on the ring and the area around the drive shaft. Be careful not to jab the drive shaft itself. After you've loosened the big chunks, run the handle under warm water with the socket facing down to rinse it out. Then, use a cotton swab dipped in rubbing alcohol to wipe the socket clean. Let it dry completely before putting a brush head back on.
If That Didn't Work
For really stubborn, hard deposits, you can soak just the top of the handle (socket area) in a 50/50 mix of white vinegar and warm water for about 30 minutes. This will help dissolve the minerals. Rinse and dry thoroughly afterward.
Heads Up
Never submerge the whole handle in water or put it in the dishwasher. Just clean the top area where the gunk accumulates.