Dark current is primarily generated by thermal excitation of electrons within the semiconductor material of the photodetector. This thermal excitation can occur due to imperfections in the crystal lattice, impurities, or even quantum tunneling effects in nanoscale materials. These thermally generated electrons and holes contribute to the leakage current that constitutes the dark current.