Actually I do know why he did it. Because in order to notate the C natural as such, He would have had to put a natural sign in front of the C. Later in the same measure, C# is needed. It is less confusing to use a B# than putting a bunch more naturals and sharps all over the place. I hope that made sense
Er...
Actually no.
The reason is very simple. But it will take a while. So bear with me.
You are probably talking about the first triplet in bar 4. This piece is written in C# minor. The scale of C#minor has exactly the same notes as the scale of E major, hence the identical key signature (F#, C#, G#, A#).
It goes: C# - D# - E - F# - G# - A# - B - C#.
This is called the natural minor scale, and it is the old Aeolian mode.
17th century musicians decided that for the purposes of melody the gap between the leading note and the tonic (the penultimate and the last note in a scale) in a minor scale was too large (a full tone). In the major scales the gap is only a semitone. So, they decided to have a semitone gap there as well and sharped the leading note of the natural minor scale. In this case it happens to be a B, hence B#.
Now the scale looked like that:
C# - D# - E - F# - G# - A# - B# - C#.
Why didn't they simply write C? Because there is already a C in the scale. Had they done so, the scale would look like that:
C# - D# - E - F# - G# - A# - C - C#.
1. It would have two Cs.
2. It wold have no B.
3. It would make a mess of the key signature which states that Cs in this scale are sharp.
How come the B# does not appear in the key signature of C# minor? Because the B# was never there inthe first place. It was an artificial construct of the 17th century musicians to make the pull from the leading note to the tonic more compelling. In fact even minor scales with key signatures with flats have sharped leading notes.
But it gets worse.
Having meddled with the natural minor scale, they realised that by sharping the leading note they had diminished the gap between the leading note and the tonic, but as a consequence they had created an enormous gap between the submediant and the leading note of 1 and a1/2 tones. Therefore they sharped the submediant (the 6th note) as well. The minor scale now looked like that:
C# - D# - E - F# - G# - A## - B# - C#.
Yes, you saw it correctly: A## (A double sharp). If you sharp the A you get the next key to the right, which is a black key. If you sharp that black key you get the key to the right which happens to be natural B. Why write A## when it is far easier to write B? For the same reasons: the scale would have two Bs and no A. By the way, the symbole for double sharp is like a small x. You can see one on bar 34 (xF, or F double sharp, or G natural).
Although there is a strong pull from the leading note towards the tonic (the leading note moves eagerly towards the tonic), there is a great reluctance for the tonic to go into the leading note. So, in terms of melody it only makes sense to sharp the leading note when the scale is ascending. Once it descends it does not matter that the gap between leading note and tonic is of a full tone. So the 17th century musicians left the natural minor scale alone when descending.
Thes situation now was like that:
C# - D# - E - F# - G# - A## - B# - C#. (ascending)
(natural minor scale with the 6th and 7th notes sharped)
C# - B - A# - G# - F# - E - D# - C#. (descending)
(untouched natural minor scale)
So, as you can see, when descending you have the natural minor scale (which has exactly the same notes as its relative major: E major) But when ascending it has a sharped leading note (to make the gap between leading and tonic of a 1/2 tone) and a sharped submediant (to normalise the gap created by the sharping of the leading note).
This is called the melodic minor scale, because all this mess was caused by melodic considerations.
Once this had been sorted out, counterpoint (the interweaving of severl melodies) went out of fashion, and the need for a melodic minor scale disappeared. Harmony (one melody with accompanying chords) took the place of counterpoint. From the point of view of harmony, all this discussion of intervals between notes of a scale became irrelevant, since harmonically you think chords, not intervals (melodically you think intervals). So the melodic minor scale fell into disuse and was replaced by the harmonic minor scale, which maintained the sharped leading note (since it made cadences more forceful) but couldn't care less about the big gap between submediant and leading note. And harmonically, ascending and desceding are equally important. So the harmonic minor scale ascends and descends equally and it is basically the natural minor scale with the 7th note sharped:
C# - D# - E - F# - G# - A# - B# - C#. (ascending)
C# - B# - A# - G# - F# - E - D# - C#. (descending)
The B# is still an accidental, so it is not included in the key signature.
Now you know.

Best wishes,
Bernhard.
P.S.
There are only 24 scales (12 major, 12 minor). 99% of Western music for the past 500 years uses these 24 scales. Get to grips with them!.