An atom is made up of positive protons, negative electrons and neutral neutrons. The simplest atom, hydrogen, had only one proton and one electron.
I don’t know how the protons and neutrons are formed in the first place, but all the atoms with more protons and neutrons than hydrogen are formed in the middle of stars, where burning fuses them together into bigger elements like lithium, carbon, silicon and iron. When the star dies and explodes in a supernova, the atoms are scattered into space where they come together to make more stars, planets and people!
Atoms were formed right at the beginning of the universe. Before this happened the universe was really really hot and all the particles had too much energy.
Right at the beginning it was so hot, even Quarks couldn’t join together (which they really like doing) because they were whizzing around so fast.
Eventually the universe cooled down (as it expanded) enough that the Quarks were able to join together to make protons and neutrons. Those new particles still had lots of energy though, so they continued whizzing around on their own for a while.
Eventually it got cool enough for them to join together (which they also like doing), making what would eventually be the nuclei of atoms.
But we were quite there yet. To get proper atoms it had to get cool enough that the electrons that were whizzing about really really fast (they have a small mass) managed to get captured by these nuclei, because the nuclei are positive and the electrons negative so they attract.
The first atoms formed about 400,000 years after the big bang when the first electrons joined up with the first protons to make hydrogen. The light that was released at that moment in time we can still see today – we call it the cosmic microwave background because the expansion of the universe has cooled it down into the microwave part of the electromagnetic spectrum.