I did very bad my sophomore year of High-school (2.8) gpa but my junior year I did very well got 4.0 gpa is there still a chance I could get into a competitive school.
Yes! Colleges want to see an upward trend on your transcript, and if you have a 4.0 Junior year like you say you do, then that will look excellent.
But be aware that taking easy classes to raise your GPA is a bad idea. A hard earned B has more value than an easy A, remember that.
Numbers aren’t enough, though. These days, you need to be “well-rounded” to get into a competitive school; you need the whole package: good SATs/ACTs, GPA, ECs and so forth.
Please keep up the trend in order to boost your overall High School GPA. Don’t let that 2.8 sophomore year screw you over. If your GPA freshman year was also bad, then reconsider applying to a competitive school next year (as it will most likely be too late to bring it up to a 3.7-3.8+)