I had my first encounter with Arduino Uno when I was 14 (I’m 16 now) when my dad gifted me an Arduino Uno on my birthday. I understood its uses and the programming, but the microcontroller itself that confuses me. I don’t get how it works and also what for are the so many different ports and pins.
A microcontroller is just similar to the microprocessor, but not exactly the same. In short, a microcontroller is an integrated circuit embedded with a processor, RAM, ROM, Ports and several other peripherals. If you take a look at the motherboard of a desktop pc you will notice that the processor, RAM, Hard disk etc are mounted externally to the motherboard. Contrary to this method, in a microcontroller, all these things are placed inside a single chip. The operational speed and application of microcontroller are also different from that of of a microprocessor. A microcontroller is not a multipurpose device. Generally, a microcontroller is programmed to do a specific task for the rest of its life ( Imagine a microcontroller inside a washing machine ).
Pins are physical leads which facilitate an electrical connection to the external devices. Ports are represented by registers inside the microcontroller and allow the programmer to control the state (input/output) of the pins associated with a register.
See the below link to know more about the difference between a microcontroller and a microprocessor: