PIC16F877A microcontroller security project
From the photos so far, I see 3 hardware problems:


No Vdd &amp; Vss connections to pins 32 &amp; 31. This is required for reliable operation. You cannot assume that the PIC will behave correctly at all times, if you only connect to the power pins 11 &amp; 12. You must connect to pins 32 &amp; 31 as well.
No decoupling capacitors close to the PIC for either Vdd &amp; Vss pins 11 &amp; 12 nor 32 &amp; 31. These are required for reliable operation.
No sign of pull-up resistors near the keypad connector on Port B, near pins 40-33. Without these, you are likely to get sporadic false keypress detection, which fits with your symptoms.


Therefore:


Please supply your schematic, as already requested by Eugene Sh. Due to your low "rep" (points) you can't add another link into your question, but add the link to the image into the comments of your question, and someone will add the image itself into your question.
Please supply another photo which includes all of the breadboard, preferably taken from directly above the breadboard itself.



Updated to add:

Thanks for your schematic. That confirms that you are missing the pull-up resistors shown in this MikroC Keypad Library page. Here is the example schematic from that page:



Notice the 10 k&Omega; pull-up resistors on the "column" connections. You need those pull-up resistors on whatever are the equivalent pins or your keypad.

Your schematic also shows no decoupling capacitors. I recommend that you research about them, and why they are required. You will find plenty of information here on EE.SE and elsewhere.

As you have now learned, a working Proteus simulation does not mean that the same schematic will work "in the real world". Proteus does not simulate real electronics phenomena e.g. floating inputs, power supply noise/spikes etc. etc.!