James Mayer was an alien from another dimension who integrated himself into the Torchwood team.
To understand the flotsam and jetsam that fell through their version of the Rift, the Border Princes integrated themselves into their host dimension, to the point where they believed they belonged there. Fail-safes were in place to remind them of their true nature in case of damage or other failure. However, this failed with James. His bodyguard subsequently needed to take steps to rectify the situation, which meant the "death" of James' earthly body.
Ultimately the team had to come to terms with the fact that a valued member of the team and a best friend to each did not actually exist. This especially affected Gwen, who had been having an affair with James and was about to leave Rhys. (PROSE: Border Princes)