Saliva is an extracellular fluid produced and secreted by salivary glands in the mouth. In humans, saliva is 99.5% water plus electrolytes, mucus, white blood cells, epithelial cells (from which DNA can be extracted), enzymes (such as amylase and lipase), antimicrobial agents such as secretory IgA, and lysozymes.The enzymes found in saliva are essential in beginning the process of digestion of dietary starches and fats. These enzymes also play a role in breaking down food particles entrapped within dental crevices, thus protecting teeth from bacterial decay.
Your fast is valid because you did not do that deliberately.
as salam alaikum
it is permissible to swallow our saliva during fasting and it doesn't break the fast.
With prayers for your success.
If the gum had a taste in your mouth, you must spit it out, but if the gum had no taste, then you are allowed to swallow the saliva and your fast is valid.
Seeing that you rinsed your mouth, and you spat out the water, that would be sufficient, and your fasting is valid, even though your tastebuds still feel the taste of toothpaste. Of course, this is as long as there is no remaining traces of the toothpaste itself, and you swallow the natural saliva in your mouth.
And Allah knows best.