The study proposes a federated learning–based automated breast cancer diagnosis system designed to improve early detection while addressing privacy and secure data sharing challenges. It incorporates encrypted image acquisition, optimal key generation, secure federated storage, and deep-learning-based classification using a capsule attention network optimized by swarm-based algorithms. Evaluated on the BreakHis dataset, the system achieved high performance, with accuracy, precision, recall, and F-measure all around 95.6%.