In order to pass the time; in order to amuse oneself.
Origin
Late 17th century; earliest use found in Thomas Otway (1652–1685), playwright and poet. From French pour passer le temps from pour for, in order to + passer + le masculine definite article + temps time.