Generally, the way you get Inspiration in 5e is by roleplaying in accordance with your character's Personality Traits, Ideal, Bond, and Flaw. This means that the ways in which your character gets Inspiration are largely determined at character creation; a good DM would likely give you the option of changing Traits, Ideals, Bonds, and Flaws as you play, but whether you roll on the random tables provided for your character's background or invent your own you've got them set up before play even starts.
But what about tying the Inspiration mechanic to the events of the game as it is played instead? Below is a hack I wrote inspired by an idea that Erik of Wampus Country floated on G+:
- Get rid of Personality Traits, Ideal, Bond, and Flaw on the character sheets for your game. Have a blank space titled Momentous Events or Legendarium or Tall Tales or whatever best fits the aesthetics of your game.
- After each session of play, ask each player what the most memorable moment (a "Momentous Event") for their character was in the session. Have them write that event down in a single line in that blank space you've made on the character sheet.
- Some examples of appropriate Momentous Events: "Punched Tiamat and lived to tell the tale," "Convinced the Frost Giant Jarl to end the War of the Nine Planes," "Lone survivor of the Bullywug Marches expedition," "Contracted the plague," etc.
- Each event that a character accumulates after sessions of play can be invoked once per session to grant the character advantage if they can relate how their past experience is helping them out in the current situation. Essentially, calling on that event grants them immediate Inspiration--as long as the DM or maybe maybe group consensus agrees that the event if applicable.
- A character can only have three Momentous Events from past sessions on their character sheet at a time. After accumulating three events they can choose to swap an old one for a new event they've just experienced after a session concludes--basically, they get to choose which events are shaping their character's personality, outlook, or legend. Or maybe traumas endured, depending on your game.