Well, apparently George asked him to play it. It's too late for me to look for a reliable quote right now, but Wiki says this:
In 1987, Harrison stated that he had been pleased McCartney agreed to play the guitar on "Taxman". In reference to McCartney's guitar solo, Harrison said, "I was pleased to have Paul play that bit on 'Taxman'. If you notice, he did like a little Indian bit on it for me." Harrison played bass guitar on the track.
Btw, if I haven't yet said welcome, then...welcome!