The conditions to find the knight at the gym are that his level must be below 8, it must be before night time, and you can't be in the middle of the Halloween cartridge event or a Curse of Hunger event. Also he only appears once a day, so if you find him and leave you will have to go again the next day to see him again