Previous studies on adaptive behaviour in single-celled organisms have given hints to the origin of their memorizing capacity. Here we report evidence that a protozoan ciliate Tetrahymena has the capacity to learn the shape and size of its swimming space. Cells confined in a small water droplet for a short period were found to recapitulate circular swimming trajectories upon release. The diameter of the circular trajectories and their duration reflected the size of the droplet and the period of confinement. We suggest a possible mechanism for this adaptive behaviour based on a Ca2+ channel. In our model, repeated collisions with the walls of a confining droplet result in a slow rise in intracellular calcium that leads to a long-term increase in the reversal frequency of the ciliary beat.