In short, it's always a violation of academic integrity to present work that you did not create as your own. However, the answer to this question is slightly more nuanced.
The first thing you need to check is whether your professor has given instructions on what uses of AI are allowed in a class or on a specific assignment. This information can often be found in your course syllabus or assignment instructions. If you can't find the information and you aren't sure, you should email your professor for clarification.
If your professor does allow use of ChatGPT or other AI tools, you want to make sure that you are using them within the guidelines provided by your professor.