First lets quickly go over the basics. It all starts with electricity. Electricity is the flow of electrons through a conductor like metal. We can use electrical components to make a circuit that does things like lights up. One such component is the transistor. The transistor is a gate for electricity. We can set the gates to be opened or closed. Using lots and lots of these gates we can make complex interactions.
At the heart of the Arduino is a microcontroller. A microcontroller is a type of integrated circuit (IC). Which means it is an electronic circuit that has been shrunk down and covered in plastic. It is filled with transistors and when we program the Arduino we are setting the gates inside to be opened or closed. When we run the program through the chip we are running electricity through the gates to perform complex calculations. How can a bunch of gates perform complex calculations? Watch this video from Evil Mad Scientist Laboratories to get an idea.
While our program is running on the chip we can use the pins to communicate. The chip can check to see if there is electricity connected to one of its pins. It can also put electricity on one of its pins. We must create the electronic circuit that the microcontroller works with. If we want our microcontroller to light an LED then we can only tell it to let electricity flow through one of its pins. We must put an LED circuit on that pin that will light up when electricity flows.