I'm not sure if it's as clear in the TV show (it's been a while since I watched season 1), but in the book it's spelled out pretty clearly that Robert was supposed to die on the hunt.
Queen Cersei gives Lancel Lannister (Robert's squire) very strong wine for Robert to drink, with the instruction that Robert should get as drunk as possible and have some kind of accident. Varys later reveals that if the boar hadn't killed him, a stray arrow would have.
Taken from A Wiki of Ice and Fire, which usually has pretty good references to the text but is missing a reference for this particular fact, for some reason.
Incidentally, this wasn't a Lannister plot, it was just Cersei. Cersei feared that her incestuous relationship with Jaime would be revealed when Robert returned, so had him killed to prevent this.