The term "astronaut" shows up in the literature long before actual space travel, in a Journal of the British Astronomical Association article in 1929, which speculated on the dangers astronauts would face. It was also used at the time for a space advocate, like in 1930: "The astronauts even suggest that artificial satellites be created to revolve around the Earth and Venus and pre-determined distances..."
Readers of science fiction certainly also became familiar, as the word seems to have first appeared in English fiction in the early 1940s, most famously with a Ray Bradbury story ("King of the Grey Spaces", 1943, later renamed "R is for Rocket") and used multiple times through his later work.
Still, this didn't mean the term was automatically going to be used, and in 1959 there was some discussion between Robert Gilruth, first director of NASA's Manned Spacecraft Center, and deputy administrator Dryden about what term should be used for the Mercury Project.
I [Gilruth] remember very well using this term to describe the men to be selected as flight crew members with Dryden. The question came up as to whether we should call them "astronauts" or "cosmonauts." Dryden was of the opinion that "cosmonaut" would probably be more accurate because astro of course, applies to the stars, and we really were beginning to probe only the nearby cosmos. However, the way it turned out, everyone we talked to seemed to prefer "astronaut," and this was the name that stuck.
NASA pretty much just started using it, and people caught on. It first shows up in reference to NASA in the Los Angeles Times, March 27, 1959:
The NASA said that the portion of the earth shown is what an astronaut pilot would see from an altitude of 120 miles above Cuba...
with the only link to the prior terminology (pilots) was using both terms at once.
At the big unveiling press conference of the Mercury 7 in April 1959, the term "astronaut" was used quite casually, as you can watch here. It was, essentially, branding by using the word in context. I haven't found any reference to a "confusion period" where people were uncertain what is meant.
(Russia did go through a similar discussion, being undecided between the Russian equivalents of "astronaut" and "cosmonaut", but went with the latter instead.)
Oddly, two other very short-lived variants that came up in the 1960-1962 period were "astronette" or "astronautess" for female astronauts, but when NASA finally sent women flying they just used the term astronaut.
Note that it doesn't mean quite everyone was happy; after all, everyone involved in flying was originally just a "pilot", and Gus Grissom, who piloted the second Project Mercury flight, reportedly said
I'm not ass anything. I'm a pilot. Isn't that good enough, fer chrissake?
...
Dickson, P. (2009). A Dictionary of the Space Age. United States: Johns Hopkins University Press.
Essays on the History of Rocketry and Astronautics: Proceedings of the Third Through the Sixth History Symposia of the International Academy of Astronautics. (1970). United States: Scientific and Technical Information Office, National Aeronautics and Space Administration.