  Context. GRB050721 was detected by Swift and promptly followed-up, in the
X-ray by Swift itself and, in the optical band, by the VLT operated, for the
first time, in rapid response mode. A multiwavelength monitoring campaign was
performed in order to study its afterglow behavior. Aims. We present the
analysis of the early and late afterglow emission in both the X-ray and optical
bands, as observed by Swift, a robotic telescope, and the VLT. We compare early
observations with late afterglow observations obtained with Swift and the VLT
in different bands in order to constrain the density of the medium in which the
fireball is expanding. Methods. We have analyzed both the X-ray and the optical
light curves and compared the spectral energy distribution of the afterglow at
two different epochs. Results. We observed an intense rebrightening in the
optical band at about one day after the burst which was not seen in the X-ray
band. This is the first observation of a GRB afterglow in which a rebrightening
is observed in the optical but not in the X-ray band. The lack of detection in
X-ray of such a strong rebrightening at lower energies can be described with a
variable external density profile. In such a scenario, the combined X-ray and
optical observations allow us to derive the matter density at 10^15 cm from the
burst. This is about a factor of 10 higher than in the inner region.
