As I understand it, WD40 is largely kerosene or something very similar - it might be good for some applications like displacing water but probably not a very suitable lube for bike chains.
It's not about lubricating the chain.. it's about running a clean, dry chain.