The "scary black painted rifles" (e.g. AR-15s) that most civilians own are not "assault rifles". (Note that the acronym in AR-15 is ArmaLite Rifle and does not mean assault rifle: see https://en.wikipedia.org/wiki/ArmaLite_AR-15 ) Civilian AR-15s and generic versions are not assault rifles.
The distinction is that rifles like AR-15s fire one bullet per trigger pull–they are semi-automatic, just other rifles, functionally the same as many hunting rifles and handgun, just larger than handguns and more accurate at longer ranges. (Some hunting rifles may be bolt-action rather than semi-automatic)
Actual "assault rifles" are distinguished by having a feature called "selective fire" which switches between being firing like a semi-automatic rifle, and firing continuously like a fully-automatic "machine gun". See https://en.wikipedia.org/wiki/Assault_rifle
Actual "machine guns" with fully automatic firing are highly regulated in the US and it's not easy for a regular person to obtain one. (For example, the Las Vegas shooter modified a regular rifle with a "bump stock" to transform a regular rifle into something that behaved like a machine gun–something that has subsequently been banned.)
Examples of actual assault rifles are the US military's M16 and the AK-47. You won't see a typical civilian possess these, unless they go through a special process of obtaining a federal permit from the Bureau of Alcohol, Tobacco, and Firearms (ATF). Because you are correct that the purpose of such weapons is military warfare; and even in the military, fully automatic fire in modern combat is used in specific circumstances (typically as suppressive fire against a large enemy force; whereas the vast majority of shots taken by soldiers would be in single-shot mode).
However there are plenty of justifiable reasons for people to possess firearms, whether rifles or handguns, such as hunting, sport shooting at a range, or personal protection (self-defense, assuming the attacker dies, is not murder).
An additional reason is that firearm ownership is protected by the US Constitution in its 2nd Amendment; and one of the reasons for its protection by the constitution is to ensure that the population can defend itself against tyranny by its own government.
(Read about the history of why it was added as an amendment; or read the US Supreme Court decision in District of Columbia v. Heller, the text of which is very readable – once you get past its analysis of the language and grammar of the amendment to ascertain its precise meaning – and provides a history of the rationale of the text and the historical reasons for its protection as a right. It analyzes the language used in the Constitution and other legal documents, carefully deconstructs the grammar in the sentence, and concludes:
> (...) We start therefore with a strong presumption that the Second Amendment right is exercised individually and belongs to all Americans. (...)
There's a lot of detailed analysis that goes into the definition of "arms" as being non-military weapons that individuals might use for hunting or self-defense; the historical protection of that right; and why it's an individual right for all Americans.)
Read the text of the court opinion here: https://www.law.cornell.edu/supct/html/07-290.ZO.html
I can respect people's opinion who wish that firearm ownership was not permissible–it's an understandable perspective, especially for those who have been affected as victims by gun violence; however, the respectable path to "solve" that problem is for the United States to amend its constitution and modify or remove the 2nd Amendment. If that's the wish of the people I can respect it. However, it's hard for me to respect the "tricks" that states or municipalities try to pull, such as banning guns on public property (which Seattle tried to do, which was overruled by the courts–helped by the Washington State Constitution's pre-emption clause, which protects firearm ownership and forbids municipalities from limiting that right); or states like California that require a permit and make getting it burdensome.