How do I know the lentils have gone bad? I brought brown lentil two months ago. Now when I cooked them under pressure they remained in the same form as before and did not even slightly swell the way normally brown lentils swell up slightly. The gravy was watery and the lentils weren’t looking as they normally look when cooked nor smelled the same as they normally do. First I cooked under pressure for 18 minutes, then it kept cooking on normal flame with the cap on top for almost an hour and it still didn’t change texture, what should I do ?
Dried lentils don't go bad as such if stored sensibly (i.e. dry), but they do go hard and take longer to cook.  It's always possible they were stored for some time before you cought them.  An overnight soak before cooking can help. Other tips include:


not adding salt/acid/sugar until they've softened,
avoiding hard water
making the water slightly alkaline with some baking soda (slightly at odds with the previous point, but I suspect calcium in hard water may have something to do with it given the use of calcium compounds as firming agents) 


It's not definitive, so you need to apply common sense, but when pulses do spoil they smell terrible as soon as you open the container.  They'd also be slimy, because they have to be wet to spoil.