Your second suggestion is essentially correct according to the company... "the name "WD-40" originated in 1953 when the product was first developed. The company, originally known as the "Rocket Chemical Company", was trying to design a protectant for metal parts on rockets to prevent rust and corrosion by displacing water... hence the "WD" for water displacement.
The "40", on the other hand, indicates that the formula (still in use today, by the by) was the 40th attempt to get it right! And they did. Talk about persistence!"...