So I have been seeing a lot of movies that take place in the future and a lot of them (such as Star Wars) use laser based weapons. Where did this come from and why intense beams of light used in a projectile manner?
The concept of beam weapons in science fiction is actually much older than lasers. It goes back at least to the Heat-Ray used by the Martians in H. G. Wells' War of the Worlds:
Slowly a humped shape rose out of the pit, and the ghost of a beam of light seemed to flicker out from it.
Forthwith flashes of actual flame, a bright glare leaping from one to another, sprang from the scattered group of men. It was as if some invisible jet impinged upon them and flashed into white flame. It was as if each man were suddenly and momentarily turned to fire.
An almost noiseless and blinding flash of light, and a man fell head-long and lay still; and as the unseen shaft of heat passed over them, pine-trees burst into fire, and every dry furze-bush became with one dull thud a mass of flames.
(The War of the Worlds, Chapter V: The Heat-Ray)
Many think that in some way they are able to generate an intense heat in a chamber of practically absolute non-conductivity. This intense heat they project in a parallel beam against any object they choose by means of a polished parabolic mirror of unknown composition, much as the parabolic mirror of a light-house projects a beam of light. But no one has absolutely proved these details. However it is done, it is certain that a beam of heat is the essence of the matter. (The War of the Worlds, Chapter VI: The Heat-Ray in the Chobham Road)
E. E. "Doc" Smith used beam weapons in the Skylark and Lensman series, which were also enormously influential.
Suddenly the shelling ceased and the Skylark was enveloped by a blinding glare from hundreds of great reflectors; an intense, searching, bluish-violet light that burned the flesh and seared through eyelids and eyeballs into the very brain. "Ultra-violet!" yelled Seaton at the first glimpse of the light, as he threw on the power. "Shut your eyes! Turn your heads down!"
(The Skylark of Space, Chapter 18: The Invasion)
Then, while Crane and the women scrambled up off the floor and hurried to the visiplates, Seaton cut in rays six, two-seven, and five-eight. Ray six, “the softener,” was a band of frequencies extending from violet far up into the ultra-violet. When driven with sufficient power, this ray destroyed eyesight and nervous tissue, and its power increased still further, actually loosened the molecular structure of matter.
(Skylark Three, Chapter V: First Blood)
Note that in both cases the weapons are described as being focused by mirrors/reflectors, not using the coherent light of a laser, which was invented much later: https://en.wikipedia.org/wiki/Laser#History
Long before lasers were actually invented, beam weapons (ray-guns, disintegrator rays etc.) had become a common trope of science fiction. The invention of lasers in real life provided a plausible* justification for these weapons, but the concept was already very well-established.
*Or at least vaguely plausible-sounding, in cases where the weapons shown don't actually behave at all like real-world lasers: Star Wars turbolasers, for example, fire glowing bolts that clearly move much slower than light speed, rather than coherent beams of light which would be invisible in vacuum.