I've tried googling this question, but I haven't been able to find any consistent/reliable information on the formation of the American police force. Was it military, federal, or local in origin?
It's a hard question to answer canonically, because the American law enforcement community is large and incredibly diverse. Here's a stab at an overview:
Federal law enforcement
Now the big one...
State and municipal law enforcement
This is a lot more complicated, as you're talking about something like 18,000 state and local law enforcement agencies — the evolution of law enforcement organisations and trends is a huge and complicated thing to explore. But in terms of pure chronological history:
Hope that helps for some chronological/organisational context.
Prior to the 19th century, most American police forces were essentially ad hoc organizations comprised of watchmen and volunteers with a constable appointed by the local government to oversee them. Their role in fighting crime was generally reactionary instead of preemptive, meaning they would only respond to crime when they were asked to by citizens.
Growing urban density in the 19th century lead to higher crime rates in American cities like Boston, New York and Philadelphia. During the 1830s and 1840s, those cities created formal police departments that took on a preemptive role in fighting crime, and other growing cities on the East Coast soon followed suit.
The westward expansion of the United States during the latter half of the 19th century, however, saw the continued use of ad hoc organizations similar to those of the colonial era. Law enforcement was generally underfunded to non-existent in the western boom towns, which didn't help the fact that the west was attracting all sorts of unsavory people to begin with. Towns would have a loose network of volunteer watchmen, vigilantes and bounty hunters, that sometimes worked with (or against) whatever law enforcement was there to take a reactionary role in fighting crime. One notable example of this type of quasi-law enforcement organization was the San Francisco Committee of Vigilance, which was essentially comprised of citizen militiamen in response to the failings of the weak local law enforcement in the city during the 1850s. By the turn of the century, however, towns and cities in the west began to adopt more formal police forces.
The growth of forensic science at the end of the 19th century and through the 20th century had a monumental impact on law enforcement. As more tools and techniques became available to investigate crime, police departments across the country began to receive more and more funding as their role in fighting crime expanded.
Tremendous growth in funding for law enforcement was compounded by a few other factors:
As high powered automatic weapons began to become more commonplace by the 1960s and 1970s, law enforcement officers found themselves ill-equipped and poorly trained to handle shootings, armed robberies, hostage takings, etc. This lead to the creation of elite, heavily equipped and highly specialized police forces, such as SWAT teams, the first of which was created by the LAPD in 1969.
Around the same time, the growing illicit drug trade and the subsequent War on Drugs placed more demand on law enforcement.
Lastly, the end of the cold war resulted in the US military having a lot of surplus equipment that has been made available to police departments on the cheap. All of this has transformed law enforcement departments into the highly funded, highly organized (though often bureaucratic), and highly militarized organizations that we know today.
(Note to mods: I have sources and I will dig them up, but I've ran out of time. Will come back and edit to include them.)
Could you clarify what you are asking? Are you talking about local police departments like NYPD (New York City's police department) or national organizations like the FBI? Or something like the county sheriff? There isn't really any organization called The American Police Force.