The city's name says "river," but there is no river. That is the famous part, and it may be only half the story.
The familiar version goes like this. On January 1, 1502, a Portuguese expedition entered a huge bay on the Brazilian coast. The sailors took the wide entrance for the mouth of a great river. They named it for the month: Rio de Janeiro, "River of January."
Who led the voyage is itself uncertain. One Wikipedia article says the Florentine Amerigo Vespucci led it, with Gaspar de Lemos in the party. Another credits Lemos or Gonçalo Coelho, with Vespucci alleged to be aboard as an observer. The accounts agree on the date and the month, and little else.
The "mistake" story is where doubts arise. Wikipedia's history of Rio questions the legend. It notes that "river" was then the general word for any large body of water.
On that reading, the sailors were not fooled. They used an ordinary word of their time for a large inlet. The name outlived the way of speaking that explains it, so later readers assumed someone had erred.
Today the bay is called Guanabara Bay. Before the name was given to the city, "Rio de Janeiro" was the name of the bay itself, Wikipedia says.
The name is also a small calendar. Janeiro is Portuguese for January, so the city's name records a date. Wikipedia dates the founding of the city itself to March 1, 1565, when it was named São Sebastião do Rio de Janeiro.
So the popular answer, a river that is not a river, is partly true. The name does mean "River of January." Whether it began with a mistake is far less certain.