I assume that CSE = computer science engineering?
Like Kitty said, pursuing a Master's degree in a different area/field might be easier than a PhD, at least in terms of admissions. Many PhD programs like to see applicants with background in the subject so they can tackle the more advanced courses immediately. As such, they might be more reluctant to take a chance admitting a Chemical Engineering major for a PhD in AI compared to admitting one for the Master's degree. In addition, PhD cohorts tend to be much smaller than Master's level cohorts, which means Master's level admissions might be (relatively) less competitive compared to PhD level admissions. You might also want to check out the discussion here (slightly different, but still relevant).
Personally, I switched fields from undergraduate to graduate school, and I got admitted to most programs to which I applied. I think the biggest challenge is explaining why you want to make the switch. A question that came up during my interviews was why I was trying to switch fields at the graduate level instead of the undergraduate level (i.e., answering the "if you are interested in this field so much, why did you get a Bachelor's degree in something else" question). If you have a good answer to this, I think you'll be at least moderately successful.
Reviewers of your application might also want to see that you have the necessary intellectual skills for the degree, but if you did well in your chemical engineering major, you should be fine because the math, science, and writing skills should all be transferable. You mention that you had "difficulties" in the CSE classes, which you may need to explain, depending on what exactly those difficulties were.
Other than these, I think you'll just face the same challenges as everyone else applying in terms of making sure your recommendation letters are strong, standardized test scores (if applicable) are good, et cetera.