

It depends on the country and the documents used to create the company.
US, UK, Australia & NZ (and probably Canada but I don’t know) have fundamentally the same (not identical but pretty close) corporate governance laws.
Yes a corporation is a separate legal entity; that was established in case law back in the 19thC in the UK (Salomon V Salomon), it does not however means that individuals are always protected, you can “lift the corporate veil” in specific circumstances (negligence fraud etc). IOW a corporation can be sued but sometimes the individuals inside the corporation can also be sued
I’m not aware of any laws in the above countries that require the presence of an explicitly named CEO role, however all the standard laws require governance of the organisation through the directors and via directors & shareholders resolutions. An individual company can specify a structure in the documents used to create it (variously called things like a constitution or memorandum and articles of association depending your country/state) mandating that certain roles need to exist within the coy but that is optional and not standard.
To address your actual point as opposed to the law, the CEO is an operational decision making functional role. If someone is making strategic decisions whether their title is Managing Director, CEO or Chief Stupidity Officer it doesn’t matter, it’s a functional role not a legal one. The legal buck stops with the directors regardless of who or what is making decisions for the company, however if there is a live person in the CEO role they can be sued on the “lift corporate veil” bases (fraud negligence malfeasance etc). If the CEO has acted within their bounds and in good faith then any issues sit with the directors (note I’m trying to condense a massive list of if ands and buts into a pithy sentence, there’s a zillion exceptions but that’s the broad rule).
So yes, the board could legally put an AI in place and direct it to run the company. If it makes bad or illegal decisions that liability rests with the directors.
If the AI oversteps its delegated authority is possibly the one area where it could get legally interesting. I would expect the directors to be held liable for any decision the AI made even if it executed something it was explicitly told not to as it is reasonably foreseeable (by anyone with a functioning brain cell anyway) that that could happen and oversight is needed. I could also see a board dragging the AI provider to court to try and hold them as being accountable (don’t think they’d win, but I can see there being a lawsuit)
EDIT some grammar/punctuation and a couple of wording tweaks for readability

This is self evidently true, or I’d be in jail for the relationships I had in my teens.
To be liable you need to have broken a law. So yes a person, or an AI, can make stupid but legal decisions, for which no legal liability accrues.
Not too sure where you’re going with this though