Dynamo action is a mechanism by which a magnetic field is self generated by the turbulent flow of an electrically conducting fluid. The recent success of the VKS dynamo experiment provides a new way to investigate dynamo action and to understand the behavior of magnetic fields of planets and stars. I present results of 3D direct numerical simulations for different flow geometries used to try to model experimental dynamos. In the case of the VKS experiment, I show how boundaries with a high magnetic permeability lead to a significant decrease of the critical magnetic Reynolds number, thus allowing the observation of dynamo action. I also understand the mechanism leading to the experimentally observed geometry of the magnetic field. Finally, I present turbulent dynamo simulations showing chaotic reversals of the magnetic field. The observed behavior present striking similarities with experimental results. These simulations show that the nature of the reversals is strongly modif ied by the value of the magnetic Prandtl number. For Pm sufficiently small, we find that the magnetic field tends to present a low-dimensional dynamic. In this limit, the behavior of the reversing magnetic field is understood using a simple model of 3 amplitude equations derived by symmetry arguments.