when do you think the writers decided foreman and chase needed to be at odds? is there an in universe reason why, even though foreman and chase seem to get on just fine in the early episodes (i'm rewatching and foreman is joking around with chase and shooting the shit [as much as he does] way more than with cameron), foreman just starts finding chase annoying and they become more antagonistic towards each other?
I think this is such an interesting question, because it's kind of on two levels: Watsonian and Doyalist.
The Doyalist reason is probably as simple as: television shows like conflict. Chase and Foreman aren't exactly enemies, but after a point they're set up more or less permanently at odds, because that's more interesting than everyone being best friends forever. A lot of the relationships on the show are Vaguely Antagonistic: see everything House does for example. Foreman and Cameron also have their moments; Cameron feuds with just about everyone, and Foreman and House's... thing... is a major part of the show. Television and stories in general thrive on conflict: this is how you reveal things. A show where everyone is polite and minds their business wouldn't get anywhere.
Chase also tends to be an odd exception to the "everyone is antagonistic" rule. That isn't to say he's a super nice friendly guy, but he really doesn't have as many conflicts as other characters do: there's about half a dozen episodes I can think of where Foreman, Cameron, and House are at odds with something (or one another), but less so Chase. (Because the show really considers him less important.) So giving him specifically someone to butt up against makes sense, and Foreman's really the best option: Chase's dynamic with House is not particularly warm or equal, so Chase being mad at House doesn't really move the story along; Chase and Cameron is its own pile of worms and the show itself points out that if Cameron knew about his Issues, her reaction would be sympathy and not conflict. As much as I'd like to see her sitting him down with tea and letting him vent, it's not interesting television. So Foreman becomes, by default, the best option for Conflict With Chase, and vice versa: Chase is a more neutral choice than House, and a more punchy choice than Cameron, so he's good as a character to glide in and poke at Foreman when required.
But why, in universe, are they at odds? I think it's actually pretty simple: Vogler.
Chase and Foreman seem to get along okay in early S1. As you say, they joke around; they sometimes team up against Cameron. I wouldn't call them best friends, but they're definitely in the coworkers who get along category.
Vogler changes that. Foreman comes in strong in Control, and lays out not just a case for why Chase should be fired (for what House himself admits was a minor mistake), but why he doesn't like Chase, as much as they might get along superficially. Foreman is someone who has had to fight and work his ass off for everything, who is constantly judged and constantly needs to prove himself, whose past is always held against him. He suffers from impostor syndrome; his boss constantly belittles him. Chase is, as I've joked, almost designed in a lab (or perhaps by a writer's room) to piss him off: Chase is an explicit nepotism hire with a famous father, rich and white and good looking. To paraphrase Treiber in S8's Post Mortem: He has looks, talent, a job people would kill for, and yet Chase... doesn't care. (As Foreman puts it.)
That isn't to say Chase is apathetic or doesn't have so many of his own issues. But from the outside? In S4, hundreds of people are desperate to get the House fellowship. Chase didn't even particularly want it, but got it anyway. Of course that annoys Foreman. And of course when people start questioning who "deserves" to be here, he thinks Chase doesn't. After S1, there's a surprisingly consistent theme of Foreman sort of... assuming the worst of Chase. Not always in an antagonizing way, but: he repeatedly (often) accuses Chase of screwing up tests or procedures or being shady and opportunistic. It's easy to draw a line from that to Vogler and Chase's actions in that arc. Foreman might think Chase is an okay guy, funny, on a day-to-day basis, but when the chips are down? "He wants to have fun, to have a good time," he tells House in Heavy. Unlike Foreman, by implication, who is here to be the best at the job.
A lot of the antagonism comes from Foreman, although that isn't to say Chase is innocent. He can be pretty sharp and loves needling Foreman, which comes up in numerous episodes. It's just that Chase really isn't terrible confrontational. Defensive, sure: he's thin-skinned and easily annoyed. But he doesn't really pick fights, he's pretty concerned with Being Liked and Winning Points (his asskissing, his smarm). He's always been pretty upfront about not finding Foreman super charming, but Chase just isn't really the type to want to die on a moral hill. Sure, the guy is annoying, but whatever. (Put another way: Chase has privilege and is used to things working out for him, so he can afford to shrug things off. Foreman is used to needing to prove himself to everyone constantly, so he can't.) They don't hate one another. They get along okay. But it's also telling that when Foreman is dying in S2, and Chase in S8, neither are that worried about the other. Or that Foreman and Taub hit it off and live together, and Chase and Thirteen go drinking and hang out, but we never really (they do so once in S5) hear about Chase and Foreman spending time together without Cameron also being there. They're coworkers, not friends. They respect one another medically and as two people who have been through the trenches but have no interest in hanging out after work. They both look down on the other. And given who they are, I'm not sure it would have happened any other way.