Unitary quantum gates constitute the building blocks of Quantum Computing in the circuit paradigm. In this work, we engineer a locally driven two-qubit Hamiltonian whose instantaneous ground-state dynamics generates the controlled-NOT (CNOT) quantum gate. In practice, quantum gates have to be implemented in finite-time, hence non-adiabatic and external noise effects debilitate gate fidelities. Here, we show that counterdiabatic control can restore gate performance with near perfect fidelities even in open quantum systems subject to decoherence.