It appears to be one of those words that just evolved. There is some support that the sulphur butterfly is the reason for the word butterfly as its wings are mainly a butter yellow.
It's a very old word, found in Old English. Like wildwood, the Oxford English Dictionary suggests that 'butter' was a reference to the cream or yellow colour of the brimstone (sulphur) and other common species found in Britain.