Here's one possible cause. Most a/c systems have a a "self-protction" system that will turn off the compressor if it is over pressurising the a/c system. So, it is either truly over pressurising or the over-pressure switch is faulty or corroded and is turning it off. Either way, you probably are better off having someone check it out.
I've had several cars do this and this is not a DIY'er because the system will probably need to be evacuated and recharged with freon.