Hey Deyan3,
I understand you're having trouble with the iPhone connecting and disconnecting to the MacBook Air. I'll be happy to help out.
Have you tried a different port, if possible, or charging cable to connect the iPhone to the MacBook Air? Also be sure there isn't any lint or debris in the charging port or port of the Mac. If you're still having trouble, see if the same issue occurs in safe mode: Use safe mode to isolate issues with your Mac - Apple Support. If it doesn't occur, try restarting normally, and trying again to see if the issue is resolved.
Cheers!