Differentiator (Op amp) with a square wave
Figure 1. Differentiator schematic from the datasheet.

You left out some important bits!


R3 and R4 have equal values. They form a potential divider and the voltage at the connection is VCC/2. Since VCC is 5 V then the reference voltage is 2.5 V or mid-supply. C2 holds this voltage steady if the 5 V supply is noisy for any reason.
Applying the bias to U1 non-inverting (+) input causes the output to stabilise at 2.5 V. Now it can swing above and below 2.5 V depending on the polarity of the pulses.
The average voltage on your Figure 3 is (3.16 + 1.84)/2 = 2.5 V.