It was occasioned by the fall of an apple, as he sat in contemplative mood. Why should that apple always descend perpendicularly to the ground, thought he to himself. Why should it not go sideways or upwards, but constantly to the earth's centre.
Newton (like Ben Franklin and his kite more than a century later) may have indulged in some self-mythologizing here. Surely, the puzzle was not that things fell down rather than sideways. Isn't that what the concepts "fall" and "down" are about?
Newton's breakthrough was not that things fell down, but that the force that made them fall extended upward infinitely (reduced by the square of the distance), that the force exists between any two masses, and that the same force that makes an apple fall holds the moon and planets in their courses.
Still, it is almost definite that his inspiration did not come from an apple dropping onto his head. That is a myth.