Why are journals used in modern scientific academic research? I am new to research and I have yet to internalize the concept of journals and their utility in archiving scientific literature.

Almost all the papers I have read recently are from this website called arxiv. Arxiv calls itself to be a preprint archive. Anyone can upload a PDF file to the repository and it counts as a valid research. Large companies like Google and Facebook post all their research here. The research is peer reviewed, It does not have the tyranny of a fixed format and the publishing is instantaneous unlike journals which are painfully slow. It is also open access and unlike open access journals it does not cost a fortune to publish a paper.

My question is, why were journals used to begin with? Why are they used now? 

I have heard some people say that if a paper is not published in a scopus indexed journal then it does not have any value. Then why are so many people publishing here? As far as I know citations from arxiv are picked up by google scholar. 

EDIT: Ok, so the entire system is a huge mess. 


https://gowers.files.wordpress.com/2012/02/elsevierstatementfinal.pdf
http://www.michaeleisen.org/blog/?p=1439
https://arxiv.org/pdf/1204.1351.pdf
Why are so many people publishing [on ArXiv]?


You have to be careful with terminology when making statements like that. ArXiv is certainly "publishing" in the literal sense of "making public" but would you say that you'd "published a book" if you'd just put it on your website? Probably not.


  My question is, why were journals used to begin with?


Because they predate ArXiv and the web by hundreds of years, though the format has changed over time.


  Why are they used now?


Partly through inertia, partly through a lack of alternatives. On a purely scientific level, ArXiv itself is not peer-reviewed. On a non-scientific level, ... People have an intuition about the quality they expect from a paper that appears in a particular journal and we don't have alternatives that allow us to make this kind of judgement. Correspondingly, certain journals have quite a lot of prestige, which is important for students early-career researchers who are looking for promotion; a large fraction of papers have at least one such author. It's easier for people like Tim Gowers to work outside that system.