This is a 1921 novel by Frenchman Andre Gide.
It is a minor piece, both in significance and in size. It belongs to that school of French literature that has the narrator be both the protagonist and his own anal retentive existentialist psychiatrist. Marcel Proust is a common example; Albert Camus, whose book The Stranger this closely resembles, is another. 1921, incidentally, is about the time when this movement was at its peak.
The book is very play-like in structure: the settings, in order of appearance, are North Africa, Greece, Paris, and rural France. Each part can be viewed as another act, another stage in the main character's fall.
His name is Michel; he is a fairly young man who has already made a big name for himself in the historical sciences. He's had no time for other pursuits. He is just married to a young woman he barely knows, but already likes--Marceline. They are on a honeymoon in North Africa, and Michel falls violently (or at least hypochondriacally) ill.
Michel is, of course, the immoralist. What makes him so is his tendency to seek out the bad and the evil in people and nurture it, observe it. He enjoys watching people commit crimes, even (perhaps especially) against himself. He is an immoralist because those that he does this to are usually simple folk--a beggar boy, a young farmhand. His Parisian sophistication makes him into a sort of vampiric Humbert Humbert. However, Gide does a good job of not slipping into Rousseau's trap--assuming that the uncivilized are automatically good. Michel merely encourages them; they do it themselves readily enough.
I would recommend this book to read in the early AM. It put much in perspective for me; though the relentless self-examination is a nuisance, this is a good novel. Not a classic; merely a good example of its class.