Apple - Compass in maps and app always wrong
I had the same problem, what you will need to do is re-calibrate the compass multiple times and it will get closer and closer with each calibration.
Make sure you are calibrating in the correct way, most people I have seen do it wrong, and it is not very clear from the diagram on the phone. There is a YouTube video which will show you how