Hi, Welcome to the horse Forum.
I am just guessing here, but I would guess that he has had too many beginners on him lately and too few 'tune-up' rides from an experienced rider to stay 'honest'. Even the best trained old horse in the world will go down-hill if someone does not ride them every few ride to keep them tuned up.
My old saying applies here --
The worst behavior or performance you allow or accept is the very best behavior or performance you have any right to expect.
Either you or another experienced rider needs to correct him for the least little bit of disobedience to your leg and rein. When he tries to 'drift' or 'bulge' out toward the barn or gate, use an outside leg and drive him over to the other side of the pen. Tune up his 'leg yielding' exercises. Get him leg yielding very obediently away from the barn or gate or buddies.
If he tries to drop a shoulder, cut corners or 'fall in' on the far side of the pen or riding area, use an inside leg to drive him deep into the corners and to keep him on the rail --- never use the outside rein to 'hold' him out -- your inside leg MUST hold him out and keep him honest.
Then make sure you and EVERY other rider rides to the far end of the pen or away from the barn before dismounting. NEVER ride to the barn and NEVER ride out the gate. Always ride past the barn or gate and always stop well away from the barn, make him stand there QUIETLY for at least 5 minute, dismount there when he is relaxed and quiet, loosen the girth and lead him to the barn.
Any of my students know better than to stop and talk on the barn side of the arena and know they better not dismount anywhere other the far corner of the pen. If you adhere to these rules, you will not have a barn sour or gate sour horse.