Well, there were a few ways the sailors and soldiers who were being attacked could tell that the planes were Japanese. The most obvious is that the planes used in the attack had large "Rising Sun" emblems on them, which were associated with Japan -- that's a surviving A6M3 Zero fighter painted to resemble what a similar plane would have looked like at Pearl Harbor.
Secondarily, the types of planes used in the attack were those that were Japanese built. The Zero referenced above is fairly recognizable due to its elliptical wings, but the B5N2 "Kate" torpedo/level bombers and especially the D3A1 "Val" dive bombers, with their fixed landing gear, would have been recognizable to people who had studied aircraft recognition manuals.
Third, the Japanese told the US they were attacking by declaring war on the US; although the attack was intended to commence 30 minutes after that warning was transmitted to Washington, delays in translation at the Japanese embassy meant that it wasn't delivered until almost an hour after the attack started (though US codebreakers had received and translated it before then).
Fourth, although there were some people on the ground in Hawaii who thought that the attackers must have been German (due to general ignorance of Japanese naval capabilities and racism towards Japan), the Japanese were the only nation in the Pacific with the carrier capability to carry off such an attack and the necessary animosity towards the US.
Just to add to /u/jschooltiger ‘s answer, even if the whole assault hadn’t been recognizably Japanese, there was only one other power in the world who could have conceivably done a carrier based attack, the British. But the early war years were rough for British naval aviation.
Courageous was sunk in 1939. Glorious was sunk off Norway in 1940. Ark Royal was sunk off Gibraltar just a month before Pearl. Illustrious and Formidable had both been damaged earlier in 1941, and although both had completed repairs, they left Norfolk too late to get to the Pacific in time for Pearl. Illustrious would have only had 8 days after leaving dry dock to load a crew, supplies, and sail literally halfway around the world.
That left the British with Furious, Victorious, and Indomitable for any early December 1941 mission. The US knew where all three were. And in any case they only carried 114 planes between them, far too few to account for the 353 planes that attacked Pearl.
In December only three countries had even a theoretical capacity to bomb Hawaii. As long as you assume the USN didn’t attack itself, that leaves the UK and Japan. With only only 2CVs and 1CVL operational the UK couldn’t have done it. Therefore... Japan.