A 500W PSU should be enough for an RX 580. It's entirely possible that the "500W" PSU you have is trash though, if it was part of the Optiplex. Consumer-grade prebuilt PSUs tend to be really bad. Try doing the test again and see if it keeps crashing.