Definitely not real. Moon Lovers is purely fictional. It's crafted by the imagination of the writers to bring an interesting and entertaining tale to the viewers.
There is a book called 'Moonwalking with Einstein' which has some elements related. Although it's not directly about moon lovers in the romantic sense, it does touch on the idea of the moon in the context of human memory and achievement. The author's exploration of his own capabilities is somewhat related to the idea of humans reaching for the moon, which was based on a true story of scientific exploration.
Yes, it is based on a Chinese novel. The drama took inspiration from a fictional story which has elements that can be related to historical settings in some ways.