Of course you can travel from Cordoba to Madrid-Barajas for a 5:30 flight unless something catastrophic happens and wrecks the AVE schedule. It's my position that you don't really gain anything by doing that.
When figuring out your timing for the day-of-flight transfer, how much of a buffer are you comfortable with, given what happens if you miss that flight (which I now know is to Israel rather than back to the US or Canada)? How much is the one-way walk-up fare from Madrid to Israel? Is the Spain-Israel leg on the same ticket as the Israel/US-or-Canada leg? If so, would missing the Spain-Israel flight cause the final leg of the ticket to be canceled? (I don't know, but I think it might.)
I don't know whether you need to be at the airport 3 hours before a trip to Israel. Even if it's just 2 hours, you still need to be at the airport by 3:30. You have to take a train from Cordoba to Madrid. It's a 1-3/4 hour trip just to Atocha Station on the AVE. That's the schedule; how much extra time are you going to allow in case something goes wrong?
From Atocha you need to get to the airport. You have to get to a different platform at the (very large and relatively complicated) station, probably wait a bit for the train, then ride to the airport. I don't know how long that takes, but with a flight coming up I'd be padding generously. Let's assume 3/4 hr. or 1 hr. or so would be reasonably safe.
Now you're at the airport, but the train station is at Terminal 4. Is that the terminal your flight departs from? If not, how long will it take to get to the correct terminal? 1/4 hr? So maybe (wild guess) the official schedules and transfer time at Atocha and the airport would indicate a total time from Cordoba to your terminal of 2-3/4 or 3 hours.
A prudent person wouldn't count on that and would take an earlier train out of Cordoba. I'd add at least 1 hr. for that padding. So I'd say it's reasonable to plan to depart from Cordoba 3-3/4 or 4 hr. before the flight. Note that I, personally, don't consider that adequate, because it doesn't give you enough time if you need to travel on a regular (non-AVE) train or a bus. But I'm sure a lot of folks would just take a train departing one hour early and not be nervous about it. I think anything less than that is placing too much reliance on everything going just as scheduled.
So you probably need to be at the Cordoba station waiting for your train by roughly 11:30 (or 10:30 if you have a 2:30 PM check-in time). How much time will it take you to have breakfast, pack, check out of the hotel and get to the Cordoba station? Surely at least 1/2 hour.
My point is: What touristy things are you going to accomplish in Cordoba in the very few hours available to you Friday morning if you need to be at the train station by 11:30 (or maybe even 10:30)? If you instead travel up to Madrid late on Thursday, you can relax and actually do some sightseeing in Madrid on Friday before heading to the airport. You'll be very close, so you can place more reliance on the train (or bus) schedules to the airport; you don't need to pad every segment of your schedule on the off-chance something will go wrong. You're not worried that you'll be scrambling to cover 250 miles by 2:30 or 3:30 PM.
They eat dinner very late in Spain. You'll have plenty of time to get a nice dinner in Madrid.