Atmega328P PU

Good mornig,

Recently I bought an Arduino Uno Board, the microcontroller that it uses is Atmega 328P PU. I bought two more microcontrollers Atmega 328P PU. the microcontroller that the board brought I can upload my programs without problems, but with the microntrollers that I bought I get error messages.

Why this happends? if the microcontrollers are identical

Those new 328P probably need to upload the bootloader. It is piece of code placed in boot region of flash memory which allows to upload your programs via USB/serial line.
Here is guide, how to bootload new ATmegas with your UNO: https://www.arduino.cc/en/Tutorial/ArduinoISP.

Bootloading also programs 3 fuses correctly for clock source and a couple other important things.