Ambient assisted living (AAL) for aging and disabled people involves creating supportive environments that leverage technology to improve the quality of life and independence of these individuals. Traditional methods for developing AAL solutions for aging and disabled people face several challenges, such as scalability, high costs, and privacy concerns. To tackle these complexities, this article proposed a novel method named stacking multiple gated recurrent-based butterfly search (SMGR-BS) for the development of AAL for aging and disabled people. In this study, stacking multiple gated recurrent units are utilized to capture intricate temporal dependencies in sensor data, and the deep recurrent neural network extracts the features from the variety of sensor inputs. Also, the butterfly optimization algorithm with a local search strategy is employed to fine-tune the parameters and enhance the effectiveness of the SMGR-BS method. In this work, the experiments are conducted on the Mobile HEALTH dataset, and the performance evaluation of the SMGR-BS method involves analyzing its effectiveness based on evaluation metrics, namely specificity, F1-score, recall, precision, and accuracy, and comparing its performance against existing methodologies to assess its effectiveness. The experimental results illustrate the effectiveness of the SMGR-BS method for developing AAL for aging and disabled people.