The decay of a neutron into a proton, electron, and neutrino is a process called beta decay. It occurs through the weak nuclear force, one of the four fundamental forces in nature.
In the beta decay of a neutron, one of the down quarks within the neutron transforms into an up quark. This transformation is mediated by the weak nuclear force, which allows a down quark to change into an up quark by emitting a W- boson. The W- boson then decays into an electron and an antineutrino. Consequently, the neutron is converted into a proton.
The important point to understand is that quarks and leptons (such as electrons and neutrinos) belong to different categories of fundamental particles. Quarks are the building blocks of hadrons (such as protons and neutrons), whereas electrons and neutrinos are leptons. They interact through different fundamental forces and have distinct properties.
The weak nuclear force is responsible for interactions between quarks and leptons, allowing processes like beta decay to occur. While quarks and leptons are fundamental particles, their interconversion is possible through the mediation of these fundamental forces.