"Alone" is when you find yourself in your own company and that it feels ok. It's when you feel content being and doing things alone, independently.
"Lonely", on the other hand, is a feeling of estrangement and emotional distance from the people around you which causes you distress. You can be in the middle of a group of friends and still feel disconnected from them, that something is missing. It's when an overwhelming combination of feelings like shame, guilt, sadness, regret and unworthiness, creep in silently when you least expect it. But when they come, they come in huge waves dragging you down to the bottom of your emotional ocean.