How keras.layers.embedding learn word embeddings?
The keras embedding layer is initialized with random weights and will learn an embedding for all of the words in the training dataset. So,the output vectors are not computed from the input using any mathematical operation. Instead, each input integer is used as the index to access a table that contains all possible vectors.
You could also use pre trained word2vec embedding.
Refer this to know more.