In the first year of President Donald Trump’s administration, Palantir Technologies has secured major contracts to compile data on Americans, assist the president’s federal immigration enforcement, and play a key role in the height of the Department of Government Efficiency’s efforts to shrink the federal government. But just a few years ago, it seemed unlikely that billionaire Alex Karp, CEO of Palantir — a publicly traded data software company that Karp in 2011 described as “deeply involved in supporting progressive values and causes" — would ever strike such deals with Trump. Karp grew up in Philadelphia in a politically left-leaning...