I swim since childhood. there is literally no science to it. You can join a class if you want. There are places that do so, even for old peaple.
If you cant join a class, best way to go is to do the 4 main styles, and practice them througly. For example, in crawl, swim for 200M by using just your legs. Then same lenght by also using one arm, keeping the other forward. Then start swiming normally.
You can repeat this process with any of the styles, although some are harder than the others. Generally it goes like this
>Butterfly: hardest
>Back: hard but not that much
>Crawl: average
>Breast: easy
At first, some styles will allow you to go tp greater lenghts without ever resting. But with enough practice, butterfly is gonna be as easy as walking.
PLEASE NOTE that, even though swiming with only your legs in any style is way harder than swiming it with 1 or both arms, its extremly important that you get used to move your arms and legs at the same time. I say it beacuse when I swim, I use my arms way more than my legs, and sometimes I even forget that I have them. This happens only in back and crawl, styles that you can swim without ever moving your legs. In Chest and butterfky thoug, legs are a mayor requirement, Specially the last one. On breast, legs and arms are equally important, and compliment each other, even tho you can swim without moving either of them. On butterfly tho, legs are a must, they are what allow you to get your upper body out of the water in the first place.
I advice to swim for anything over 1 hour. At least twice a week. Remember that swiming REALLY wears you out, and you may feel the after effects for hours after it. For example, I swam for 1:30hours and finished at 11:15. Still feeling tired and sleepy. But its really rewarding. Swiming is considered by many to be most complete sport, since it all your body extensively. It gets you an awesome body, and an ungodly strenght.
Godspeed bro, may your gains come quickly, and remain forever.