Both versions are correct.
The simple past indicates a state or an action during during a finished or closed time period.
Ex:
Yesterday, I went to the gym.
Last week, I went to the gym three times.
The present perfect indicates a state or an action during an unfinished or open time period.
Ex:
This week, I have gone to the gym three times.
The past perfect emphasizes a state or action that precedes a later state, action, or moment.
Ex:
Last Saturday, I helped Joe move to a new flat.
Before the move, I had gone to the gym many times. So, on Saturday, I moved heavy furniture with ease.
When the earlier state or action occurred in a closed time, the simple past and the past perfect are correct.
Ex:
Last Saturday, I helped Joe move to a new flat.
The previous week, I had gone / I went to the gym many times. So, ...
In the original text, “During the previous week” is an important clue that a later state, action or moment has been discussed. So, the action of “going to the gym” is earlier and calls for the past perfect (“had gone to” or “had been to”).
In real life, native speakers aren’t careful about distinguishing these tenses. For Americans, the present perfect and past perfect are often replaced by the simple past tense plus time words, such as before or after, to clarify the meaning. See English Grammar in Use by Murphy or Practical English Usage by Swan.