  (Abridged) We report on observations of the optical and NIR afterglow of
GRB020405. Ground-based optical observations started about 1 day after the GRB
and spanned a period of ~10 days; archival HST data extended the coverage up to
70 days after the GRB. We report the first detection of the afterglow in NIR
bands. The detection of emission lines in the optical spectrum indicates that
the GRB is located at z = 0.691. Absorptions are also detected at z = 0.691 and
at z = 0.472. The latter system is likely caused by clouds in a galaxy located
2 arcsec southwest of the GRB host. Hence, for the first time, the galaxy
responsible for an intervening absorption system in the spectrum of a GRB
afterglow is identified. Optical and NIR photometry indicates that the decay in
all bands follows a single power law of index alpha = 1.54. The late-epoch VLT
and HST points lie above the extrapolation of this power law, so that a plateau
is apparent in the VRIJ light curves at 10-20 days after the GRB. The light
curves at epochs later than day ~20 after the GRB are consistent with a
power-law decay with index alphaprime = 1.85. We suggest that this deviation
can be modeled with a SN having the same temporal profile as SN2002ap, but 1.3
mag brighter at peak, and located at the GRB redshift. Alternatively, a shock
re-energization may be responsible for the rebrightening. A polarimetric R-band
measurement shows that the afterglow is polarized, with P = 1.5 % and theta =
172 degrees. Optical-NIR spectral flux distributions show a change of slope
across the J band which we interpret as due to the presence of nu_c. The
analysis of the multiwavelength spectrum within the fireball model suggests
that a population of relativistic electrons produces the optical-NIR emission
via synchrotron in an adiabatically expanding blastwave, and the X-rays via IC.
