Q:

How did words starting with f- become h-?

Many Spanish words that nowadays begin with h- used to begin with f-, for example:

hacer < facere (PT fazer, IT fare, FR faire),
hijo < filius (PT filho, IT figlio, FR fils)
haya < fagea (PT faia)

Can anyone explain this change?

A:

How it exactly happened is unknown. The change itself is not really difficult to imagine. It's a frequent phonetic change in many languages.* One can say it's a kind of lenition (weakening): /f/ involves a well-marked friction between the lips and the teeth, while /h/ is considered by some to be less than a full fricative consonant (more like an approximant).
Why was /f/ prone to change?

Vulgar Latin /f/ was probably not actually labiodental but bilabial [ɸ] (like blowing air out through almost closed lips), so it was rather weak to begin with.
This /f/ was the only fricative in that point of articulation, and the only fricative in the whole system other than /s/, which was much more common; it was phonologically isolated, the odd one out. Such isolation tends to favor the change or disappearance of sounds. On the other hand this also meant that /f/ could sound really like our labiodental [f] or else like bilabial [ɸ], as that would make no difference.
Latin /f/ was also very restricted in its position: for historical reasons it only appeared at the beginning of native Latin roots. (It could appear elsewhere in words like dēfendere, derived from a root fend-, or in borrowings like rūfus.)

All of these made it easy for /f/ to change its pronunciation. In some regions it seems that /f/ was pronounced [h] before posterior vowels (/o/ and /u/) and [ɸ] before the other vowels and consonants like /r/ and /l/. In some others, particularly in northern Castile (where modern standard Spanish comes from), it apparently changed to [h] everywhere. There are traces of this change already in the 9th century. Even then this [h] was disappearing, continuing a process that had already begun in Vulgar Latin.
The only place where /f/ (pronounced [hɸ]) was kept was before [w], that is, in words like fuego (< Latin focum). This would later revert to [f], as well as other words, generally borrowed from Latin or other languages as learned terms (cultismos).

*For a quick reference, check out Index Diachronica; this shows a list of documented instances of /f/ becoming something else in lots of languages (search the page for things like f → h and f → ɸ).

