In the 1976 film it was presented that a flight of USN planes spotted a lone Japanese ship steaming hard. They deduced that it was it trying to catch up to the main carrier fleet and followed it. In reality it was a lone USN sub doing picket duty that spotted the carrier fleet and alerted higher ups that the Japanese carrier force was searching for the USN carrier force.
The story I had heard was that the destroyer was prosecuting a depth-charge attack against a US sub, gave-up, and was racing back to assume its place in the destroyer screen of the Japanese carrier strike force.
I’ll have to re-watch “the Battle of Midway” to see if it includes the US submarine sending the first notice of locating the Japanese fleet. The morning of the battle, a PBY crew made the first sighting of the carriers.
What you recall of the SBD’s following the lone destroyer is correct, but that was after the initial location sent by the PBY and then the intercept point was mis-calculated by one of the carrier CIC’s. Cdr Wade McCluskey led the dive bombers and followed the Jap destroyer that he figured was heading to rejoin its main fleet.
This Wikipedia article is quite accurate about the battle of Midway: https://en.wikipedia.org/wiki/Battle_of_Midway