Autoencoders learning

Tried to learn about autoencoders, and got the idea that they learn targets.

But how do they learn if we don’t provide them targets at first place?

Is this something like k-mean learning…?