I tried the following circuit simulation in Proteus where transistor is used clamp the input voltage -2.5V to 2.5V to 0V to 5V but I am not getting the expected output voltage as shown in the graph. Why is it not working and how do I choose the capacitor and resistor values?
I could be wrong, but it seems to me people are confusing clamping with clipping. A circuit that changes a -2.5V/+2.5V signal to 0V/5V is a clamp. A circuit that limits excursions beyond +/-2.5V is a clipper.
For minimum offset of a simple clamp, use a large (e.g. 1A) Schottky diode instead of a transistor:
The capacitor value you need depends upon the input frequency and the output load resistance.