You both sacrifice it and deal the 5 damage at end of combat.

Artwork
Loading artwork…
Time Elemental
Fifth Edition · #129 · EN
Nonfoil—Foil—
Card rules
When this creature attacks or blocks, at end of combat, sacrifice it and it deals 5 damage to you.
2
,
: Return target permanent that isn't enchanted to its owner's hand.
0/2
Rare · Illustrated by Amy Weber
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Old School Legal
Penny Legal
PreDH Legal
Premodern Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Pioneer Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
A “permanent that isn’t enchanted” is a permanent with no Auras on it.
If Time Elemental attacks or blocks, but you no longer control it at end of combat, you can’t sacrifice it. However, it will still deal 5 damage to you.