Car dies after five minutes of driving

I honestly know very little about cars, so I’m not sure where the sound is coming from. I don’t know if it helps to mention that when my car would run for longer than five minutes at a time, the ticking noise would eventually go away.