The National Air Duct Cleaners Association recommends every 3–5 years for a typical home. That's a reasonable baseline. The right answer for your home depends on a few things:
Pets. Shedding animals put a lot of hair and dander into returns. Homes with 2+ pets are usually closer to every 2–3 years.
Allergies or asthma. If someone in the house has respiratory sensitivities, more frequent cleaning meaningfully reduces airborne triggers.
Recent construction or remodels. Drywall dust and sawdust get pulled into ducts fast. Clean before running the HVAC afterward — or as soon as possible if you already did.
Smokers. Nicotine residue coats duct interiors and holds odor. Every 2 years is a reasonable schedule.
Moving into a new home. You don't know what the previous owner's air was full of. Start clean.