There is a very small difference in terms of nuance between the two..........
First, I'll write the exact meanings of these words(based on the Korean Standard Dictionary)
연인
- Two people who are dating each other.
- Someone you really love and/or miss.
애인
- Someone you share deep affection with and love deeply in your heart.
- Someone you really love and/or miss.
As you can see, the second meanings are IDENTICAL, so the two words can both be used to call your lover, but 애인 has more of an affectionate nuance to it, while 연인 has a more grown-up(mature?) feeling to it.
The main difference is that 연인 can be used to call your lover, but can also be used as a word for 'couple'(two people).
남자친구 and 여자친구 literally means 'boyfriend' and 'girlfriend'...
Hope this helped XD