I shall nerd.
Warhammer 40k includes a very long timeline, thus the name. Sometime before now and the 'Horus Heresy' (the event that incapacitated the emperor, 10,000 years before the current time in universe) humanity reaches a golden ages of prosperity. Reaches across the stars and sets up a thriving interstellar federation. Things are more Star Trek-y than they are Warhammer at this point. Technology is extreme and its around this time that the majority of technology existing in the universe was developed. But, artificial intelligence was one of the creations of the time and things didn't go fantastic.
A lot of the historical records are lost, but eventually a race called the 'Men of Gold', an augmented subrace of humans, popped up. They created the Men of Stone (also augmented) who in turn created the Men of Iron, artificial intelligence. The Men of Iron eventually overthrew their creators and started an intergalactic war with humanity that took an alliance of multiple races to quell. After that point, artificial intelligence became outlawed and humanity fell into stagnation. When the Warp itself became more difficult (and eventually impossible) to navigate, humanity fell further into ruin. Its from that situation that the Emperor reveals himself and begins his nonsense.