Reaction of CaO with C $\ce C$ is a good reducing agent and hence it can remove oxygen from $\ce{CaO}$. But instead of forming $\ce{Ca}$ and $\ce{CO}$, the products are $\ce{CaC2}$ and $\ce{CO}$.
Why does this happen?
Why would it not? C is a nonmetal, and it is common for nonmetals to form compounds with metals. Oxygen gives oxides, nitrogen gives nitrides (if you succeed in making him react, which may be not quite trivial, but that's another story), chlorine gives chlorides, etc. Now, C is less eager to take extra electrons than N or O, so it would form ionic carbides only with active metals. Well, Ca is pretty active.