It's not that WD-40 will harm the chain, but it's mostly kerosene mixed with a small amount of heavier oil and some other additives. "Heavy" means more viscous, but also less volatile. So, WD-40 mostly evaporates, leaving the chain under-lubed.
A heavier oil is needed for chains, mainly just so it doesn't evaporate right away. Motor oil is just fine, or three-in-one, basically anything that you can apply easily. If you've got kids, then you've got a supply of syringes that you get with their medicine from the pharmacy.
For cleaning the chain, the old standby is to dunk it in kerosene and scrub with an old toothbrush if necessary. Get a chain rivet tool and learn how to use it. If you let the kerosene drain out of the chain, you can oil it right away and the kerosene will evaporate soon.
Of course there's nothing wrong with the bike-specific lubes and cleaners either. One thing to consider is if you might need to replace your chain. No point cleaning a stretched chain. I go through a chain per year on my commuter bike.
Might as well go ahead and bookmark the Sheldon Brown website.
Note that kerosene is flammable, and kerosene soaked rags are dangerous.