The energetic midfielder has become the latest big name to leave the Makhachkala outfit and will continue his career in the Russian capital
The Frenchman, 28, had moved to Dagestan from Real Madrid in the summer of 2012 and helped Anzhi to third spot in the table last term. However, the holding midfielder was deemed surplus to requirements following the Russian side's change of policy and will now continue this career with Lokomotiv.
Diarra has signed a three-year deal with the Moscow outfit.
Players such as Oleg Shatov (Zenit), Yuri Zhirkov, Igor Denisov, Aleksandr Kokorin (all Dinamo Moscow) and Mbark Boussoufa (Lokomotiv) previously left Anzhi following the club's changed policy.
Attacking midfielder Willian is widely expected to leave the club as well in the coming days after undergoing a medical with Tottenham this week, while Samuel Eto'o has been linked with clubs such as Roma, Chelsea and Inter.
Anzhi secured the services of a number of high-profile names in the past few years, but it nows aim to build a new team consisting mainly of homegrown youngsters as it felt the club's big investments was not paying off.