Let $\Delta : M \to M \times M$ be the diagonal map. Since $M$ is a complex manifold, say of complex dimension $n$, it has a canonical orientation class $[M] \in H_{2n}(M, \mathbb{Z})$. Then you can take the pushforward in homology to get $\Delta_\ast [M] \in H_{2n}(M \times M, \mathbb{Z})$. If $M$ is compact then $M \times M$ is also compact and you can use Poincare duality to get an element in $H^{2n}(M \times M, \mathbb{Z})$. This is the cohomology class of the diagonal.
More generally, the words to look up are Thom isomorphism theorem or Gysin sequence or Gysin map. The inclusion $\Delta$ induces a Gysin map $\Delta_\ast: H^i(M) \to H^{i-(-2n)}(M \times M)$. The cohomology class of the diagonal is the image of $1 \in H^0(M)$ under this map. You can do the same kind of thing in $K$-theory, Chow groups, etc.
Let $\Delta : M \to M \times M$ be the diagonal map. Since $M$ is a complex manifold, say of complex dimension $n$, it has a canonical orientation class $[M] \in H_{2n}(M, \mathbb{Z})$. Then you can take the pushforward in homology to get $\Delta_\ast [M] \in H_{2n}(M \times M, \mathbb{Z})$. If $M$ is compact then $M \times M$ is also compact and you can use Poincare duality to get an element in $H^{2n}(M \times M, \mathbb{Z})$. This is the cohomology class of the diagonal.