He has overstepped his boundaries. The CTO works for the founders, he cannot really fire you (asking you to leave is just a polite war of phrasing it). Remind him that it is the duty of any smart manager to hire people who are smarter than him. That is what you did.
My guess is that your position with your cofounder is rather weak at the moment. The cofounder is probably stepping back and saying "This CTO guy knows what he is doing and if I have to choose, I would much rather go with him". That is a tough situation to be in. If that is true, it isn't your CTO firing you (he is just the front man), it is your cofounder. In fact, ONLY your cofounder can fire you (or your investors if you have sold them a big enough share).