Carbon monoxide gas produced by a giant impact in the inner region of a young system