Let $G$ be a Lie group and $\mathfrak{g}$ its Lie algebra.
The adjoint representation of the Lie algebra $\mathfrak{g}$ is defined as:
$$ \text{ad: } \mathfrak{g} \rightarrow \text{End}(\mathfrak{g}), X \mapsto [X,\cdot] $$
Now, it holds true that
$$ \text{ker ad} = \mathfrak{z}(\mathfrak{g}) = \{X \in \mathfrak{g} : [X,Y] = 0 \quad\forall\; Y \in \mathfrak{g}\}.$$
On the other hand, the definition of the kernel of this homomorphism is (at least in my mind)
$$ \text{ker ad} = \{ X \in \mathfrak{g} : [X,\cdot] = \text{id}, \text{ i.e. } [X,Y] = Y \quad \forall \;Y \in \mathfrak{g} \}, $$
since the group identity in the endomorphism group is the identity-map.
Evidently, the two sets are not the same, but where is my mistake?