From the moment we meet Phil Connors, we can tell he's a jerk. Sure, he has to act charming professionally (because he's a weatherman), but once he's off camera, we see just how much contempt he has for the world around him.
When asked about how excited he is to cover the Groundhog Day festival in Punxsutawney, he bluntly answers,
PHIL: They pull the little rat out. They talk to him. The rat talks back to them. They tell us what's going to happen.
His producer Rita thinks that Groundhog Day is just good clean fun for wholesome small-town folk, but it's clear Phil considers them to be hicks. Rita doesn't argue with him, but it's clear from her looks to the cameraman Larry that neither of them like Phil's company all that much.
Unlike Phil, they're just too polite to say so to his face.
It's pretty clear that Phil Connors is only interested in looking out for Phil Connors. He delivers his Groundhog Day TV spot as insincerely as possible and does such a bad job of hiding his contempt that Rita even asks him,
RITA: Want to try it again without the sarcasm?
But no, Phil doesn't want to try it again. He wants to get out of Punxsutawney as soon as possible because all he cares about is pursuing a life of selfish pleasure.
Once he starts reliving Groundhog Day, it doesn't take Phil long to realize what's going on. At first, he gets totally paranoid and thinks that someone is playing a joke on him. He grabs a dude in the hallway of his B&B and tells him,
PHIL: Don't mess with me, Pork Chop. What day is this?
But he eventually realizes he's truly stuck in Groundhog Day, and once he replays the day a few times, he learns that he can use his situation to be even more selfish than he usually is:
PHIL: We could do whatever we want!
Phil really shows us his selfish side when he asks a stranger named Nancy all kinds of personal questions about herself, then uses her answers to trick her into sleeping with him the next time he relives Groundhog Day. When Nancy asks him if this is just a one-night stand, Phil despicably lies to her and says,
PHIL: On the contrary Nancy. I love you.
From the beginning, we can see that Phil's selfishness must run pretty deep, since his first reaction to an insane situation is to use it for his own gain by treating other people as objects.
Eventually, Phil spends such a long time giving himself pleasure that it all becomes blah and he loses the will to live. The truth is that the guy's selfishness has run out of steam and everything has started to bore him. So he decides that the best thing to do is kill himself and put an end to Groundhog Day.
But nope. That doesn't work. He keeps waking up on Groundhog Day even after he tries to kill himself. It's only at this point that he begins to realize that there might be more to life than the simple choice between selfish pleasure and suicide. Go figure.
After he's been stuck reliving Groundhog Day for a good long while, Phil realizes that he wants to be a better person and that he can do this by being more like his producer Rita. So he sets out to learn as much about Rita as he possibly can. And the more he learns, the more attracted her becomes to Rita. Of course, his first instinct is to try and sleep with Rita. The plot even works at first, but when Phil tries to get Rita into bed, we realize that Phil has only changed his behavior and not his heart.
As Rita tells Phil in his B&B room,
RITA: I can't believe I fell for this. This whole day has just been one long setup.
And that's pretty much true. Even after Rita has seen through his ruse, Phil continues to think of new ways to make her like him. He keeps making notes about things she likes and doesn't like, repeating facts to himself like:
PHIL: No white chocolate, no fudge.
This studying suggests that despite Rita's anger, Phil plans on trying all of his schemes again the next day.
Eventually, Rita can only demand to know,
RITA: Is this what love is for you?
And the sad truth is yes, Phil still thinks of love as tricking someone into liking you. Phil still thinks of the people around him as things to be manipulated for his own pleasure. We might want to believe Phil's a good guy, but he's just not there yet. He'll have to change more than the way he acts if he's ever going to convince Rita (or us) that he's become a decent guy.
As the movie enters its final stages, Phil Connors eventually learns how to be a better person and not just act like one. It's not easy to say exactly when this moment happens, but it probably happens around the time Phil has a perfect day with Rita and realizes that it's still not enough to get him out of Groundhog Day. There's only one explanation to this turn of events: Phil realizes that being good means more than being kind to the person you love. It means being kind to everyone.
Thus, Phil learns to escape Groundhog Day when he realizes that everyone in the world is important, not just the woman he's trying to attract (Rita). After he's finished making a passionate speech about Groundhog Day, he even rejects Rita's offer for coffee date to say,
PHIL: I'd love to. Can I have a rain check? I've got some errands to run.
The errands he's talking about are all the nice things he plans on doing for the people of Punxsutawney during the rest of his afternoon. This act of sacrifice shows us that Phil has truly learned to put the happiness of other people before his own.
After a day of helping as many people as possible, Phil finally realizes how to win Rita's heart. It's by being a genuinely kind person and by taking pleasure in his own kindness. The change ultimately pulls him out of Groundhog Day, as Phil wakes up the next morning with Rita beside him. He tells her he loves her and his first instinct is to ask:
PHIL: Is there anything I can do for you today?
Phil has gotten what he wants (an escape from Groundhog Day), but he has changed so much that his first impulse is now to think of others before himself. All in all, Phil has gone from pursuing a life of selfish pleasure to finding fulfillment in helping other people. The movie even implies that anyone would make the same change if only they were given enough time to relive the same day.
And to that, we have only one thing to say: Awwww.