Uranium dioxide (UO$_2$) is an important industrial material which is employed as a fuel in most nuclear reactors world-wide. The doping of UO$_2$ with small amounts of chromium oxide Cr$_2$O$_3$ is technically applied to obtain a larger average grain size after the fuel sintering process. In this study the local environment of chromium in UO$_2$ was investigated using X-ray absorption spectroscopy. An interpretation of the X-ray absorption spectra is a non-trivial task, especially for so complicated systems like doped fuel. Here we will address this challenging problem using two approaches, in which the ab initio EXAFS theory is combined with classical molecular dynamics (MD) or ab initio molecular dynamics (AIMD) as well as electronic structure simulations based on density functional theory (DFT). The atomic scale MD and DFT simulations were carried out using the CP2K code. Alternatively, DFT simulations were performed to determine the influence of the chromium doping on the fuel matrix. The atomic structure around the chromium impurity was relaxed, and the resulting structures were used to calculate the Cr K-edge EXAFS spectra. The comparison of the simulated EXAFS spectra derived from DFT results with the experimental one allows the identification of valid atomic configurations. The limitations of this approach are discussed.