The presence of chaotic transients in a nonlinear dynamo is investigated through numerical simulations of the 3D magnetohydrodynamic equations. By using the kinetic helicity of the flow as a control parameter, a hysteretic blowout bifurcation is conjectured to be responsible for the transition to dynamo, leading to a sudden increase in the magnetic energy of the attractor. This high-energy hydromagnetic attractor is suddenly destroyed in a boundary crisis when the helicity is decreased. Both the blowout bifurcation and the boundary crisis generate long chaotic transients that are due, respectively, to a chaotic saddle and a relative chaotic attractor.