Good question.
Warhammer 40K was originally called Rogue Trader. I believe it was out before 1992.
As for Warhammer, I believe it was released before 40K. I'm not sure the year.
Games Workshop has been around for some time. They use to have way more games. Their White Dwarf 'zine use to have articles for D&D and other role playing games as well as for their games. (I found some old issues).
I hope that I helped.