I hit upon the idea of going there alone.

Literal

I [topic-は] alone there [toward-へ] go-[volitional-よう] [quotative-と] thought-of.

思いつく (おもいつく, 'to think of, hit upon an idea') — a compound verb. ~しようと思いつく uses the volitional form + と + 思いつく for 'hit upon the idea of doing.' ひとりで ('alone, by oneself').