David (Shawn Hatosy) shoots Alan (Jonathan Rhys Meyers) and gets Jenny (Rachel Leigh Cook).
David has manipulated the whole situation. He set Alan up to hook up with the girl Alan picked up for David at the bar (David told her to meet him at Alan's house when David and Jenny left to have dinner with Jenny's dad so that when they came back they'd catch Alan and the girl hooking up). He also turned Alan in for the drugs in his house and he made it look like Alan was stalking Jenny after the breakup so she would be afraid and stay with David/get together with him finally.
When Alan gets out of jail he comes back to confront them (the assault we see at the beginning of the movie) because he thinks that David or Jenny turned him in about the drugs and he wants to know which one did it.
David has been telling the story to the police and made it seem like Jenny came to him after Alan messed things up by cheating on her, etc. Alan confronts them and takes them to an old house they'd explored together -- although David tells the police he shot Alan in defense of Jenny, David really shoots Alan as he's bent over Jenny trying to help her because David couldn't compete with Alan (Jenny still loved him) and it was the only way he could get her. At the end, Jenny and Alan are brought into the hospital and David and Jenny walk out together as Alan lies in a coma.
Thanks Fern J (Pooper) and Linsey (Longer)!