You can, but I don’t recommend it. ChatGPT isn’t always factually correct because it was trained on information from the internet, and there is plenty of inaccurate text online. You’ll also find many ChatGPT answers are at least partly plagiarized, which almost certainly goes against the academic integrity policies of your school or university.
If you do use ChatGPT to help you with your homework, bear in mind that you’ll have to do plenty of fact-checking to ensure the answers are correct.