Yes, the sentence "He was leaving of his own accord" is grammatically correct and natural. It means that the person was leaving voluntarily, without being forced to do so by anyone else.
The phrase "of his own accord" is an idiomatic expression that means "voluntarily" or "by one's own free will." Other ways to express this idea include "by choice" or "of his own volition."