(UUT is "Utterly Unsupported Theory," by the way, shorthand in here for answers
that are based on creative conjecture from the evidence we have in the texts.)
The basic answer to your question is that no one has any real idea. I've
put in a link below to a good essay on some of the possibilities. You
might read that first since my answer below is a far-fetched effort to come up
with a new idea based on the Silmarillion, so if you haven't read it... you
might stick to the slimy.com essay!
One idea I wanted to throw in is that Bombadil might be one of the spirits that
descend into the living things of the earth (the olvar or flora as
opposed to the kelvar or fauna). These spirits appear in the
Silmarillion chapter "Of Aule and Yavanna" in which Yavanna is mourning the
destruction to her plant and trees that will be wrought by the Children of
Iluvatar. Manwe consoles her by saying that spirits (Ainur or lesser
Maiar) will come to inhabit some of those olvar; this is what accounts
for the Ents, the other "oldest" living things in Middle-earth. Now what
if Bombadil is one of those spirits, a kindred to the Ents, but who is not
living inside a natural form? Manwe tells Yavanna that "When the Children
awake, then the thought of Yavanna will awake also, and it will summon spirits
from afar, and they will go among the kelvar and the , and
some will dwell therein, and be held in reverence, for their anger will be
feared." Note that not all of these guardian spirits go inside the
kelvar and olvar, only some of them do and the rest go "among"
the growing things. Now this might account for how both Bombadil, a
keeper of the forest, and Treebeard, an Ent shepherd of the forest, both call
themselves the oldest. They might be siblings, both spirits helping to
tend to trees on behalf of Yavanna, but one resides within a tree and the other
doesn't. This could explain why the two are so similar despite their
physical differences, and could be the real reason that Treebeard gets
Bombadil's lines in the movie: sibling rivalry led to the one brother
stealing the other's role!
We could extend this to Goldberry, though there it's complicated because the
water is under Ulmo, not Yavanna. Maybe Ulmo copied Yavanna and wanted to
send some protective spirits to help the streams and rivers too.
.... Or not! Hey, airballing it here big time, but at least it's a stab
at a new twist on the "nature spririt"
answer.
Gandalf did not move. And in that very moment, away behind in some courtyard in the City, a cock crowed. Shrill and clear he crowed, recking nothing of wizardry or war, welcoming only the morning that in the sky far above the shadows of death was coming with the dawn.And as if in answer there came from far away another note. Horns, horns, horns. In dark Mindolluin's sides they dimly echoed. Great horns of the North wildly blowing. Rohan had come at last!