Selfish and Self Serving are two different things. Garp did this because Garp wanted to as he believed it was right.
It’s like Luffy attacking Ennies Lobby, he did it for selfish reasons, because he wanted to save Robin.
Garp acts like a pirate because he literally does things the same reasons pirates do. Even his moniker “the hero” is shown to be a lie as according to the record he got it for saving slaves and CDs on God Valley. But oda confirmed the only reason Garp was there was because he wanted to fight Roger. If Roger never appeared Garp wouldn’t have gone to save the slaves or CDs at all.
He’s a pirate in a marine coat.
Yes... Because... He despises the CDs and just does not want to help them. He sees them as rotten people. That's not really a matter of him being self serving or whatever you call it, he simply just refuses to help people that shouldn't be helped.
He still immediately went to help Koby out because he believes Koby is a good person. That's different from pirates who typically would never stick their neck out to help another person like that.
He's almost nothing like pirates, even if you prove that he's selfish like them that's just him sharing one quality with them. He doesn't pillage, rape, kill, etc. and is vehemently against ANYONE doing that.
The whole point of Garp is that, while other Marines consistently behave like Pirates, he goes against the norm and so does his protege Koby. He believes in actual justice for both Pirates and CDs.