Let's get some non-technical stuff out of the way first;
EmmaL wrote:I suspect that he is flirting with one of his female workmate.
Every man in the world firts with female co-workers. Everyone, no exceptions. This is nothing to worry about in itself.
EmmaL wrote:Is it legal if I spy on his mobile phone?
I can't give you a definite answer on this since I'm not a lawyer but I'm pretty sure it is not legal.
One last sidebar;
If you have these suspicions and you don't want to him to flirt with other women at work, this is NOT the way to resolve it. Spying and unvoiced suspicions isn't going to make your relationship more open and honest.
Now for the technical content;
EmmaL wrote:Is there any keylogger for iOS 9?
Yes. However the device needs to be jailbroken for this and even then it's often pretty difficult with the application separation on the device. Most I've seen hook some functions in the software keyboard. There are also a few that create an overlay which the user types into that then gets passed to the real app underneath but these tend to cause weird buggy behavior in a lot of apps.
EmmaL wrote:It needs to be undetectable and invisible.
As long as there's no antivirus apps running on the device, that should not be a problem.