Yes, you can change the order of your Pokemon when battling a gym in Pokemon Go.
To change a Pokemon, enter the gym and tap the button that has a boxing glove icon in the bottom right corner. When your list of Pokemon appears (you should have six Pokemon appear, these will be your Pokemon for the gym battle), they go in order from top left to bottom right. This means that your top left Pokemon will be your first Pokemon, while the bottom right will be your last Pokemon in the gym battle.
To change, simply tap which Pokemon you want to change. When you tap your Pokemon, it should bring up a list of all your Pokemon that are able to battle, and you can choose a different Pokemon by tapping it as well.
For example, if I was battling a fire Pokemon, and my top left Pokemon was a grass-type when I prepare to battle, I would probably tap the top left Pokemon to change it to a water type.
Here’s a picture:
Tap on the screen where the red circle is drawn, where it says crudely says “Tap”