I went to the sports office to apply for the last position on the basketball team, but someone had already beaten me to it.
Literal
I [topic-は] basketball-team [possessive-の] last [possessive-の] position [possessive-の] application [object-を] do-[volitional-よう]-[quotative-と] sports-office [toward-へ] went [but-が], someone [subject-が] ahead [object-を] overtook-[completion-てしまった].
A long, narrative sentence. 申し込みをしようと ('intending to apply') uses volitional + と for purpose. 先を越す (さきをこす, 'to beat someone to it, get ahead of') is an idiom — literally 'to cross ahead.' ~てしまった marks the completed, regrettable action. スポーツ事務所 ('sports office') and バスケットボールチーム are loanword compounds.