There are a lot of guides out there making what is a simple combat system out to be super complicated, requiring study akin to mastering piloting of a combat helicopter, whilst having Carolina Reaper rubbed into your eyes in the middle of a sandstorm. Which it ain’t.
Success of attacking any gym is based on few factors. Gym level which dictates number of defenders, and the type and level of defenders versus your own Pokemon.
Level 8 gym for instance will have 8 defenders, and there is a good chance they will be decent level and varied, making gym hard to take.
You on the other hand will get six Pokemon to take to the battle, and the initial suggested Pokemons will be based on what the game AI thinks is the optimal setup to win against that particular set of defenders.
This is reasonably useful, and you will likely change this as you go along once you get to develop some preferences with regards to Pokemons you own and their levels and abilities.
Game will not recommend any Pokemons that are below 100% HP, so ensure that every high level Pokemon is healed up.
Complete list, if you can be bothered to go to that level of detail, of what is optimal attack against particular defence, is listed in this thread on Reddit. Dependent on types, damage matrix will either be deemed “super effective”, normal or “Not Effective”. Super effective gives you 1.25 damage multiplier, Not effective gives you 0.8 damage multiplier.
Once you are actually fighting, there are three things you can do. You can spam the normal attack, which of course, you will do. This in turn fills your specials meter. Specials in turn get activated by pressing and holding the screen until you see the progress bar slide to the end and your special execute.
Final “move” you have during the combat is to dodge attacks. Generally, no point trying to dodge normal attacks. Depending on what the opponent has in terms of the special, it’s a judgment call whether to take the pain or dodge. Normally, you should try and dodge when you see the message flash up that they are executing the special. You dodge by swiping left or right, and whilst it can take some practice, it’s very much doable.
If you have any friends, and are on the same team, you can take them along, and you can tag team the attacks - as you can have more than one attacker. It will save you time if nothing else.
Finally, once you have taken the gym, do take some time to level it up - our guide to leveling up gyms is here