I answered this same question back in November, but I'll repost it here because the upvotes seem to indicate there's interest.
Yes.
In 1837, the merchantman Morrison traveled to Japan, ostensibly to return some Japanese sailors whose junk ran aground near the mouth of the Columbia River. Upon finding out the Morrison was unarmed, the ship was given warning shots from coastal batteries and returned to Macao with the Japanese sailors aboard.
This experience was not unique to Americans: Since the 17th century, this had been the pattern for Western countries. If they rescued Japanese sailors (or if the Japanese rescued their sailors), they'd send a merchantman to return the men and then use the opportunity to try to open trade. This inevitably failed. In the case of Russia, it failed bloodily.
In 1846, the U.S. government sent an expedition consisting of the Columbus (90 guns) and the corvette Vincennes. The ships stayed for 10 days, during which time they were blockaded by a fleet of Japanese guard boats, but no one from the American ships landed on shore, nor did the Japanese make much contact except to say that no trade could be allowed with any foreign nation but Holland.
Three years later, the Preble was dispatched from the U.S. Navy's Chinese squadron to Japan after receiving a report from Dutch Batavia that 16 American seamen had been shipwrecked on a Japanese island and were being kept prisoner. After arriving at Nagasaki, the Preble was surrounded by Japanese soldiers and guns, just as the Columbus and Vincennes had been. Commander James Glynn was no one to be intimidated, however, and he began negotiations for the return of the men.
When Japanese officials reacted with indifference, he pressed them hard with the "bluntness of a sailor," and said that if they didn't turn over the wrecked sailors, he would make them do so. The Japanese needed just two days to release the men.
After this, the next official American government trip was Perry's expedition.
Now, these are just the direct American government trips. They do not count the numerous American merchantmen who arrived or attempted to arrive in Japan. Because the Dutch operated the trading operation in Japan and the latter part of the 18th century was the era of the Napoleonic wars, the Dutch occasionally hired American ships to handle trade to and from Japan in order to keep that trade from being intercepted by the British. (Remember, Holland was occupied by France during this period and was a de facto part of the Napoleonic Empire.)
American ships were typically hired at Batavia, India or other equatorial ports, then dismissed once they completed their voyage to and from Japan. As the war went badly for France, so too did it go badly for the Dutch. Between 1808 and 1813, not a single Western ship arrived in Nagasaki, home to the Dutch trading mission. When ships finally arrived, they were British. To keep the Dutch trading post in operation, they had to pretend to not be British, and Dutch trade continued.
Perry's expedition was well publicized, so much so that a Russian squadron visited Nagasaki simultaneous to Perry's arrival at Tokyo. Soon after the Russians departed, a British squadron also visited. The Dutch, for their part, sent word to their emissaries and attempted to play both sides. They told the Japanese that they wanted to protect Japan, but after the United States got its treaty, the Dutch declared, "In fact, the Netherlands have always desired an opening of Japanese ports, in the general interest, and in favor of commerce."
If you're interested in learning more, Perry's journal is online.
The short answer is yes, some Japanese people knew about the existence of the U.S. The long answer involves getting into some of the problems with the assumptions behind this sort of question.
The main issue is that thinking of Japan as completely cut off from the outside world during the Tokugawa's so-called sakoku (鎖国 "locked country") policy is a very common, but rather mistaken, understanding of the policy and period. I say "so-called," because the term sakoku was not actually the term used for most of the time that the policy was in effect, but rather an early 19th century attempt to translate a Dutch-German term--already an indication of the extent to which this interpretation comes from a perspective that focuses only on the European powers that were forbidden trade. Kaikin (海禁 "maritime ban") is the term that was used at the time, and offers a better picture of what was going on. Some more recent historians have even gone as far as to suggest that we see the policy as a "selective opening" under the monopolistic control of the Shogunate, rather than a closing at all. At the very least, Japan never stopped trading with China, Korea, the Ryūkyū islands, or the Dutch, and Japan still relied on trade with those partners through dedicated ports.^1 Through those windows, they had access to information from around the world.
Before the maritime ban even started, maps based on those of famed Jesuit Mateo Ricci were imported to Japan, and there were definitely Japanese produced maps that included the Americas as early as 1645.^2
While they were not particularly relevant in political and cultural circles for the vast majority of the Tokugawa era, there were also a number of "Dutch studies" (rangaku) scholars who were dedicated to learning from books that the Dutch brought them. Many of them specialized in immediately useful topics, such as gunnery, but they also translated works on anatomy and more general topics. Their knowledge expanded over time to include a basic conception of the geopolitical world outside of Japan. That knowledge, and the incidents with American ships that occurred before Perry showed up, mean that at least some Japanese knew the US existed.
Much of that knowledge was limited, and held by a select few, but it was still there.
See John Lee's "Trade and Economy in Preindustrial East Asia, c. 1500–c. 1800: East Asia in the Age of Global Integration" for more information on the extent to which Japan was integrated in regional economies.
Marcia Yonemoto, "Maps and Metaphors of the 'Small Eastern Sea' in Tokugawa Japan (1603–1868"
I doubt ordinary people knew much of the world beyond Japan, but educated elites had a window through the world via the Dutch settlement in Nagasaki harbour. As evidence, you can see a Japanese map of the world as of 1850, before the black ships arrived, at this webpage: https://suite.io/naoko-charity/4dc927g
Just to add to that; the US is mentioned in Aizawa Seishisai's Shinron (New Theses), but Aizawa is pretty confused about what precisely it is, and particularly its relationship with the UK. So there was definitely awareness that it existed; the details were a bit fuzzy though.