Formaldehyde is a colorless, pungent, and highly volatile toxic gas known for its detrimental effects on the brain, respiratory, and nervous systems. The adsorption method emerges as an effective approach for detecting and mitigating formaldehyde gas, with the adsorption material serving as its core component. Graphene, a two-dimensional nanomaterial with remarkable properties, exhibits enhanced adsorption capabilities when subjected to metal doping, which alters its local geometric and charge characteristics. In this investigation, theoretical first-principles density functional technology was employed to optimize the efficiency of Fe-doped graphene in formaldehyde adsorption. The calculated adsorption bond length and energy were used to determine the type of adsorption. Then, the calculated Bader charge, density of states (partial density of states), and differential valence charge density distribution were used to analyze the electron transfer process before and after adsorption. Finally, the theoretical optical properties analysis result was applied to analyze the potential of Fe-doped graphene for formaldehyde detection. The findings indicated that Fe-doped graphene constitutes a viable and stable doping structure, accompanied by a notable shift in valence charge distribution around the doped iron atom. This altered charge distribution facilitated the chemical adsorption process, leading to reduced adsorption spacing and increased adsorption energy. Throughout the chemical adsorption process, there was evident charge transfer between carbon (formaldehyde) and iron atoms, as well as between oxygen (formaldehyde) and iron atoms. The formation of adsorption bonds primarily involved the p-orbital electrons of carbon and oxygen atoms, along with the p- and d-orbital electrons of iron atoms. Ultimately, the Fe-doped graphene material exhibited promising applications in the realm of formaldehyde molecular detection, marked by significant theoretical disparities in optical properties before and after the adsorption process.