It is one thing doing it to a US carrier on it's own but a Carrier task force with full support of submarines, frigates etc would be very difficult
The exercises against the Swedish sub was with a CBG and even the exercise where the Chinese sub came up, must had at least coalition vessels as support too, so a carrier will never be alone. It's of course difficult, but not impossible with modern techs, even for an SSK.