Hey, I have to add though, seriously don't take anything that hasn't been prescribed. And even if it's only store-bought sleeping tablets, if you also take any other meds, check with the pharmacist that it doesn't interact. For example, some sleeping tablets can be dangerous with some antidepressants, even fatal. Nytol for example is basically an antihistamine. Drowsiness is a side effect of antihistamines, so it is essentially a side-effect only medicine! If you already take Piriton or something, this might add up to a higher than safe dose. And alcohol is out if taking sleeping drugs, right? Just a thought. Sorry to be boring.
Most medicines are like this. "Side-effect" is arbitrary. It just means not the effect you're taking it for.
So, it's not a side-effect that diphenhydramine (benadryl) causes drowsiness when you're taking it as a sleeping pill. It being an anti-histamine is a side-effect.
Loperamide is a common medication taken for diarrhea (immodium). It's an opiate derivative much like hydrocodone/oxycodone. Except it can't pass through the blood-brain barrier so you can't get "high" off of it. One of the side-effects of opiates is slower smooth muscle contraction, which is why people can have problems with constipation when they take opiates. But when you have diarrhea, this an effect that can help ease the symptoms by keeping food in your intestines longer so more water can be absorbed.
One should definitely be careful with any sort of chemical they ingest... but keep in mind, it's all just chemistry and anatomy. No need to fall into magical thinking about it. You should definitely read about what you're ingesting though. With the internet, there's really no excuse to be completely ignorant on what you shove down your throat anymore.
Obviously, if it's a prescription, it's slightly safer (depending on your level of ignorance) since there are going to be checks for other current medications, but really, medical doctors aren't exactly experts in medications and their various interactions (or even mechanisms surprisingly). A good pharmacist would probably be a better bet (probably depending on what country you're in).
As for wetting while on sleeping pills, I've taken a variety of sleeping medications can't say I've experienced this with any of them. I'm sure it's possible though. Everyone reacts slightly differently to medications due to their own biochemistry. I would not take them to achieve this effect though or suggest doing so.