Historically, giving a lock of ones hair to someone has been considered a sign of love and devotion, especially before an impending separation. It is still a popular trope in fiction, particularly the romance genre.
In this case, Gimli is quite enraptured with Galadriel's beauty....he's never seen anything or anyone quite so beautiful...including the traditional precious metals and jewels Dwarves are renowned for coveting.
He originally asks for nothing in both the book and the script
"Nothing. Except to look upon the lady of the Galadhrim one last time for she is more fair than all the jewels beneath the earth."
But then asks something he thinks is impossible...
He continues to Legolas as they leave.
GIMLI: "I have taken my worst wound at this parting having looked my last upon that which is fairest. Henceforth I will call nothing fair unless it be
her gift to me."
LEGOLAS: "What was it?"
GIMLI : "I asked her for one hair from her golden head. She gave me three."
The fact that Gimli asks for nothing "useful" or precious in the traditional sense makes the asking all the more romantic especially as dwarves were known as only interested in digging for precious items in Middle Earth.
Gimli is unusual, one might think, in this respect. Indeed, the book makes the point of mentioning (from Galadriel) that gold would not control him, even if he gets a great deal of it.
Then the Lady unbraided one of her long tresses, and cut off three golden hairs, and laid them in Gimli’s hand. ‘These words shall go with the gift,’ she said. ‘I do not foretell, for all foretelling is now vain: on the one hand lies darkness, and on the other only hope. But if hope should not fail, then I say to you, Gimli son of Glóin, that your hands shall flow with gold, and yet over you gold shall have no dominion.
Farewell to Lorien - Fellowship of the Ring - J.R,R. Tolkien