Apple is named after a fruit because the founders could not think of anything better.
The company began on April 1, 1976, when Steve Jobs, Steve Wozniak and Ronald Wayne registered Apple Computer Co. as a partnership. Wikipedia's history of the company says Apple Computer, Inc. was incorporated on January 3, 1977.
Jobs gave his own account to Walter Isaacson, his biographer. He said he proposed the name while on one of his fruitarian diets. It "sounded fun, spirited and not intimidating," he said. Macworld, which reports the same quotation, says Jobs came up with it after visiting an apple farm.
Accounts of the moment differ. Macworld says Wozniak recalled Jobs suggesting it on a drive back from the airport. Wikipedia's page on All One Farm puts the idea on a car ride back from the farm, where Jobs had worked in the apple orchard. Wozniak also called the popular garage-founding story a bit of a myth.
There was a practical side too. In the 1970s companies often chose names that would sit near the front of the phone book. Jobs said the name would put Apple ahead of Atari, where he had worked. In a 1980 presentation he said this was partly why they chose it, alongside his liking for apples.
Wozniak's own version, in his memoir iWoz, is the least romantic. Macworld says he wrote that the pair tried to find more technical-sounding names, could not, and kept Apple.
The word itself is older and broader than the fruit. Etymonline says Old English æppel meant "apple; any kind of fruit; fruit in general." For centuries, English used the word for most fruit other than berries.
Two logo stories get mixed up with the name. Rob Janoff, who designed the bitten-apple logo, said the bite was there to show scale so it would not be mistaken for a cherry. Some people believe it honors Alan Turing, but Janoff said it does not.
The company kept the name for more than three decades. On January 9, 2007, it dropped "Computer" and became Apple Inc. The name later led to legal fights with the Beatles' company, Apple Corps, and in 2006 a High Court ruled in Apple Computer's favor over the iTunes Music Store.