Whether or not universities detect ChatGPT, and will know if you have copied from the service, is tricky to answer. Technically, code will not be flagged by most plagiarism detectors, so your professors may have some difficulty actually identifying what is AI-generated or not. They may be suspicious, though.