Why led be is dimmer in pin 2 than in pin 13 ?

Are you using a resistor? It might have too much current going through it, making it dimmer(I'm not sure if that's possible, but maybe?).

That resistor is a current limiting resistor that simply limits current and thus controls too much current to be at a level which is comfortable to make the LED lit and not burn it, if you use a Led without a resistor then it will burn with outrageous brightness and will first get hot and then its filament with in will burn by becoming hot and will melt.