Here's a simplified explanation:
1. High Temperature and Pressure: The intense heat and pressure in a star's core overcome the electrostatic repulsion between protons.
2. Proton-Proton Chain: A series of reactions occur, starting with two protons colliding to form a deuterium nucleus (one proton and one neutron). This deuterium then collides with another proton to form a helium-3 nucleus (two protons and one neutron). Finally, two helium-3 nuclei fuse to form a helium-4 nucleus (two protons and two neutrons) and release energy.
This process, known as the proton-proton chain reaction, is the primary way stars generate energy and produce helium.
It's important to note that while this is a simplified description, the actual process is much more complex and involves various intermediate steps and isotopes.