Water dissolves salt, sugar, and a bunch of other stuff and corrodes iron and a lot of other metals, but we all know water (provided you’re not drowning and it’s not polluted with other dangerous stuff) is perfectly safe and not toxic or bad for you.
Similarly, oils dissolve latex, rubber, and some plastics, because of how their molecular structures work (they’re both non-polar which basically allows them to interact with each other in a way that they don’t with say… water, just like how water doesn’t mix with oil, and salt won’t dissolve well in oil) This doesn’t mean oils are bad or will dissolve you, it just means be careful with oil around your rubber and plastic objects.
Also silicone will sometimes dissolve other silicone so don’t use silicone lube on your silicone sex toys and store them so they don’t touch.
Be safe and don’t use oil based lube with latex condoms because it will degrade the condom and make failure way more likely.
Also this is the chemistry in so far as I understand it, I read a bit and I am not well versed in chemistry so I welcome corrections.