You have to meet her first, and she's hard to miss — she's the one dressed entirely in purple. Find her at the Contest Hall in Hearthome.
Talk to her there, and only then will the gym become available. Walking straight to the gym before that conversation is why a lot of players get turned away with no explanation.