Lonely is a feeling or emotion. For example, "I went to a new school today and felt lonely because I didn't know anyone". Lonely can be a similar feeling to sadness or missing someone.
Alone is when there aren't any other people around. For example, "I was at home alone for three hours" means you were the only one in the house for three hours. It's certainly possible to feel lonely when one is alone, but that's not always the case. One can also feel happy, relaxed, etc.
Hope this helps!