Yes, not only can you do yoga. I would say you should do yoga.
Sure, yoga has a reputation of being performed by people who are already very flexible, but yoga and other types of stretching is how you get there.
For any position that you can't do because you're too inflexible, or are suffering from tight muscles, there's always a more moderate position you can do instead. Take, for instance, the position where you just bend over with straight legs and touch the floor with your hands. Impossible, right? But the act of trying will stretch the muscles that need to stretch in order to get there. So if your hamstrings are on fire by the time your hands are down to your knees, then there you go. That's your current level for that particular position, and you're getting all the benefits of it.
One of the things I do, and recommend, is finding some "follow-along beginner yoga/stretching" videos on YouTube, putting them on your phone or TV, and get on the floor. If you're anything like me, then you're not going to look as elegant as the instructor, but do it 3-5 times a week for 5-15 minutes each time, and you'll soon see progress.
Try switching it up too. Maybe don't do the same video every time for a whole month, but keep a rotation going. Of course come back to the ones you like.