A purpose is something placed in front of you. The word comes from Old French porposer — 'to put forth, to intend' — from Latin prōpōnere, composed of prō- ('forward') and pōnere ('to put, to place'). Your purpose is the thing you have set before yourself as an aim.
Latin pōnere is one of the most productive verbs in the language. Its past participle positus gave English position, deposit, and composite. Its compounds are everywhere: propose (put forward), oppose (put against), compose (put together), dispose (put apart), impose (put upon).
Purpose and propose were once the same word. Old French porposer split into two forms: English took purpos for the noun (the aim itself) and propose for the verb (the act of putting it forward). French standardised on propos — the basis of à propos, meaning 'to the purpose'.
The word's sense of determination — 'a person of purpose' — developed in Middle English. An aim placed firmly before you becomes a commitment. Purpose shifted from describing an intention to describing the resolve behind it.
The phrase 'on purpose' (deliberately) dates from the 16th century. Its opposite, 'to no purpose' (pointlessly), is older — Chaucer used it. Both phrases reveal the spatial metaphor: purpose is a destination. To act on purpose is to walk toward it. To act to no purpose is to walk nowhere.