Back on Gallifrey, lifetimes ago, they were boyhood friends, inseparable, but staring into the Untempered Schism changed that. It was a rite of passage for all those wishing to enter the Academy to become Time Lords; afterwards, neither one of them was quite the same. It changed them in ways the Doctor thinks they will probably never fully understand.
Now, instead of close friends, they’re in opposition, the Doctor always trying to mend things and people while the Master constantly seeks to tear down and destroy.