on the other hand when I downloaded the piece from the Internet, the mordent at this place was missing:
So, did it exist in the original Bachs piece or was inserted by an editor later?
Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
This is easily answered in the literal sense, by looking at what Bach actually wrote:
On the other hand, what Bach actually played is not necessarily the same thing - and bear in mind that most of this prelude was originally written as a set of chord changes, as an improvisation exercise for his son Wilhelm Friedemann, so there is some historical justification for playing anything you like!
First remark that manuscripts of Baroque pieces are wildly different. Part of the reasons are that back then there is no concept of a fixed substantiation of a piece. Players are allowed and even expected to add ornaments themselves, and even melody may be modified. If Bach himself had written that phrase twice, he may have erased that mordent, or add even more ornaments. I am not saying this is good or bad, nor saying all ways are equally good (they are not, otherwise criticism of performance loses its point), but in general Baroque conception of music performance was rather free.
Things are different in later ages, when composers usually give detailed indication of ornaments, articulation, and dynamics. He may have been happy (or crossed) when hearing a performance of a piece of his, with some modification by the player.
I remember one Urtext edition I possess has that mordent there as you pointed out, which indicates at least one reliable manuscript has it. Use it or ignore it according to your judgement.
Jazz music or popular music likewise gives more license to the players; an singer, bass player, or a drummer are all likely to change the original key, rhythm, and sometime melody of the piece in question, and in some respect music is creative and fun to them. In the "classical" context, however, the modern concept of a definite edition of music is at least somehow problematic. I agree that we should try hard to know, and respect, the composer's intention. But on the other side of the matter, music performance always requires a certain degree of freedom.