At first sight it might seem the incident with the lion is not relevant to the plot. But it becomes clear that this lion is another agent of the Lord, in addition to the Timnite woman. This attack on Samson begins a chain of reactions that will ultimately lead to Judges 15:19.1
5 Then Samson went down with his father and mother to Timnah, and they came to the vineyards of Timnah. And behold, a young lion came toward him roaring.