When I use the screen as a viewfinder, it works fine. But when I use it to show the settings, it turns off after around 10 sec. I've to press the info button to turn it back on.
Is there some setting that can cause this or my camera is faulty.
You're looking for c2: Auto off Timers in the Custom Settings Menu. This is explained on page 160 of the Nikon D5100 Reference Manual — not to be confused with the abridged User's Manual, which leaves out most of the details.
It sounds like you are looking to change Auto meter-off, which Nikon describes as the time the "information display remain[s] on when no operations are performed". When set to
normal, that goes off after 8 seconds. Changing it to
long will give you a minute.