The primary function of argentaffin cells is to secrete hormones and bioactive substances such as serotonin, which plays a crucial role in regulating gut motility and secretion. These cells also produce other important compounds like histamine and chromogranins, contributing to various physiological processes in the gastrointestinal system.