You can earn one coin every 10 minutes, which comes to six per hour. Your Pokemon has to defend the Gym for eight hours and 20 minutes straight to earn a maximum amount of 50 coins.