Aims. To study the abundance and temperature of ammonia in the center of a nearby galaxy M 51 and to compare them with those in other nearby galaxies, we observed its (J, K) = (1, 1), (2, 2), (3, 3), and (4, 4) inversion transitions at the wavelength of 1.3 cm. Methods. The observations were carried out with the Effelsberg 100-m radio telescope. Results. The (1, 1), (2, 2), and (3, 3) transitions are clearly detected, but the (4, 4) transition is barely detected. The rotational temperature obtained from the (1, 1) and (2, 2) transitions of para-ammonia is 25 ± 2 K, which is similar to those of M 82 and the Large Magellanic Cloud (N 159 W), but significantly lower than those of IC 342 and NGC 1068 among the nearby galaxies. The column density of ammonia is (8.1 ± 2.4) × 10 13 cm −2 , and the abundance relative to H 2 is ∼4.5 × 10 −9 . The abundance in M 51 is about a factor of 5 lower than those of NGC 253 and IC 342, but about one order of magnitude higher than those of M 82 and the Large Magellanic Cloud. The addition of the data of M 51 further supports the exceptionally low abundances of ammonia reported previously in these two galaxies. For understanding the abundance of ammonia in M 51 and other nearby galaxies, their temperatures were compared. As a result, we found that the galaxies with low temperature tend to have low abundance of ammonia. In addition, the photodissociation rate of ammonia was compared to those of related molecules detected in the nearby galaxies to discuss the effect of photodissociation. We found that the low abundance of ammonia in some galaxies cannot be explained only by the effect of photodissociation.