Is there a medical condition where someone is a compulsive liar but honestly believes the lies are the truth?
Someone who behaves in the way you described may be diagnosed as a pathological liar, often with narcissistic tendencies. A narcissist feels the need to draw attention to themselves, have all of the answers, etc. Generally they believe that they are not enough and so need to make themselves appear to be more or better in order to have others like or respect them. The interesting thing is that they may know that they are making it up at the moment. However, they tend to begin to believe their own lies and they amy become outraged if they are questioned or if they think you don't believe them. There is a sense of righteous indignation that may be just as great as it would be if what they were telling you is really true. In a sense, it becomes true for them. Truely pathological liars are often sociopaths and many people in the prison system share this issue.
Some psychologists say that they believe that a pathological liar may be able to partially recognize the falseness of what they are telling others is their attention is drawn directly to the lie in a strong way so that they have to examine it, but most pathological liars will resist examining themselves this closely.
Some say that there is what is referred to as a "double consciousness" state where "two forms of life run side by side, the actual and the desired, and the desired becomes preponderant and decisive." In other words, the fantasy can become stronger for them than the reality. On the other hand, there are also people wh simply lie frequently.