Some people feel more energized all day after a workout, so going before work is a good idea for them. This may also be advantageous so that you're not tired at the gym after a long day of work. On the other hand, some people are far too exhausted after a workout and would probably be unable to give 100% at work if they went to the gym before hand. Also, depending on your job hours, committing to waking up extra early to work out can also be very difficult.
In short, unless one choice or the other negatively affects your job performance, just go whenever you'd most consistently be able to make it according to your personality type, preferences, schedule, etc.