Naphtali and Dan received their inheritance in Canaan. Dan’s territory included some Philistine cities, Timnah and Ekron, and it also included some land beyond what Joshua allotted them. Leshem was adjacent to Dan’s territory, and they attacked it and took it.
Dan did not drive out all the Philistines, and they were a thorn in their sides for years. However, they did take land that they were not assigned, an act of aggression, maybe, but definitely an act of ambition. When God shows you a way to take the enemy’s territory, be ambitious and take the land for the name of the Lord!